After upgrading _docker_ to _Server Version: 17.12.0-ce_ and _docker-py_ to 3.0.1
Getting error:
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/docker/client.py", line 81, in from_env
kwargs_from_env(kwargs))
File "/usr/lib/python2.7/site-packages/docker/client.py", line 38, in __init__
self.api = APIClient(args, *kwargs)
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 110, in __init__
config_dict=self._general_configs
TypeError: load_config() got an unexpected keyword argument 'config_dict'
When using simple call
import docker
c = docker.from_env()
Is it a known bug?
What version of _docker-py_ is compatible with _docker17.12.0-ce_ ?
Regards
P.S. downgrading to _docker-py2.7_ solves the issue
That's quite odd - config_dict is a valid argument for load_config in 3.x, so there's no reason that error should happen.
Is it possible you have different versions of the package interfering with one another, maybe inside / outside a virtualenv?
I am running into the same problem. I had to downgrade to docker-py2.7. Currently using docker Version 17.12.0-ce-mac49
I fixed it by removing python and python packages and re-installing python. Installing the legacy docker-py package appears to cause issues when installed along the latest docker package.
Is it possible you have different versions of the package interfering with one another, maybe inside / outside a virtualenv?
Yes, different versions caused an issue on my machine. I had to remove python and re-install it.
I am getting the same error in a pipenv virtualenv
$ docker --version
Docker version 17.12.1-ce, build 7390fc6
Python 3.6.4,$ pipenv graph
click==6.7
crayons==0.1.2
- colorama [required: Any, installed: 0.3.9]
docker==3.1.2
- docker-pycreds [required: >=0.2.2, installed: 0.2.2]
- six [required: >=1.4.0, installed: 1.11.0]
- requests [required: !=2.18.0,>=2.14.2, installed: 2.18.4]
- certifi [required: >=2017.4.17, installed: 2018.1.18]
- chardet [required: <3.1.0,>=3.0.2, installed: 3.0.4]
- idna [required: >=2.5,<2.7, installed: 2.6]
- urllib3 [required: >=1.21.1,<1.23, installed: 1.22]
- six [required: >=1.4.0, installed: 1.11.0]
- websocket-client [required: >=0.32.0, installed: 0.47.0]
- six [required: Any, installed: 1.11.0]
GitPython==2.1.8
- gitdb2 [required: >=2.0.0, installed: 2.0.3]
- smmap2 [required: >=2.0.0, installed: 2.0.3]
giturlparse==0.9
halo==0.0.12
- backports.shutil-get-terminal-size [required: ==1.0.0, installed: 1.0.0]
- colorama [required: ==0.3.9, installed: 0.3.9]
- cursor [required: ==1.2.0, installed: 1.2.0]
- log-symbols [required: ==0.0.11, installed: 0.0.11]
- colorama [required: ==0.3.9, installed: 0.3.9]
- enum34 [required: ==1.1.6, installed: 1.1.6]
- six [required: ==1.11.0, installed: 1.11.0]
- spinners [required: ==0.0.19, installed: 0.0.19]
- enum34 [required: ==1.1.6, installed: 1.1.6]
- termcolor [required: ==1.1.0, installed: 1.1.0]
ipython==6.2.1
- decorator [required: Any, installed: 4.2.1]
- jedi [required: >=0.10, installed: 0.11.1]
- parso [required: ==0.1.1, installed: 0.1.1]
- pexpect [required: Any, installed: 4.4.0]
- ptyprocess [required: >=0.5, installed: 0.5.2]
- pickleshare [required: Any, installed: 0.7.4]
- prompt-toolkit [required: <2.0.0,>=1.0.4, installed: 1.0.15]
- six [required: >=1.9.0, installed: 1.11.0]
- wcwidth [required: Any, installed: 0.1.7]
- pygments [required: Any, installed: 2.2.0]
- setuptools [required: >=18.5, installed: 39.0.1]
- simplegeneric [required: >0.8, installed: 0.8.1]
- traitlets [required: >=4.2, installed: 4.3.2]
- decorator [required: Any, installed: 4.2.1]
- ipython-genutils [required: Any, installed: 0.2.0]
- six [required: Any, installed: 1.11.0]
numpy==1.14.2
Traceback (most recent call last):
File "dockapt.py", line 12, in <module>
docker_client = docker.from_env()
File "/home/dev/.local/share/virtualenvs/dockapt-LVPjMQXP/lib/python3.6/site-packages/docker/client.py", line 81, in from_env
**kwargs_from_env(**kwargs))
File "/home/dev/.local/share/virtualenvs/dockapt-LVPjMQXP/lib/python3.6/site-packages/docker/client.py", line 38, in __init__
self.api = APIClient(*args, **kwargs)
File "/home/dev/.local/share/virtualenvs/dockapt-LVPjMQXP/lib/python3.6/site-packages/docker/api/client.py", line 110, in __init__
config_dict=self._general_configs
TypeError: load_config() got an unexpected keyword argument 'config_dict'
Here are my Pipfile and Pipfile.lock
Downgrading to docker==2.7.0 using pipenv install "docker<3" solves the issue
Fixed in 3.1.3
Have the same issue still with docker 3.3.0
Traceback (most recent call last):
File "/net/netstore2/vol/paas_clusters_vol/cluster336/PAAS/paas-config/1.1.290/ServicePostDeploy/mariadb", line 77, in
docker_client = docker.from_env()
File "/usr/lib/python2.7/site-packages/docker/client.py", line 81, in from_env
kwargs_from_env(kwargs))
File "/usr/lib/python2.7/site-packages/docker/client.py", line 38, in __init__
self.api = APIClient(args, *kwargs)
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 110, in __init__
config_dict=self._general_configs
TypeError: load_config() got an unexpected keyword argument 'config_dict'
You probably have old artifacts messing up your imports. Remove all docker and docker-py packages (inside/outside virtualenv) then reinstall.
@shin- i am using python 3.6 version and trying to import the docker
and i got the
TypeError: load_config() got an unexpected keyword argument 'config_dict'
please tell me whats happing exactly inside the code
@shin- removed dockerand docker-py packages, reinstalled docker and docker-py packages and getting the error still:
docker_client = docker.from_env()File "/usr/lib/python2.7/site-packages/docker/client.py", line 81, in from_env
kwargs_from_env(kwargs))
File "/usr/lib/python2.7/site-packages/docker/client.py", line 38, in __init__
self.api = APIClient(args, *kwargs)
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 110, in __init__
config_dict=self._general_configs
TypeError: load_config() got an unexpected keyword argument 'config_dict'
python version is
Python 2.7.5 (default, Aug 4 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
On other system, your suggestion helped:
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.import docker
c = docker.from_env()
You can't have docker and docker-py in the same environment, they're incompatible.
i'm confused sorry, what should be installed then? just docker?
docker-py docs offers to run:
pip install docker
import docker
what is docker-py, then?
I'm getting the sense that if I'm trying to use the docker module with Python2, I need to install "docker<3", but that's not covered by the module documentation anywhere that I can see? The README suggests to just install 'docker', and the pypi docs suggest 'docker' is compatible with Python2, but if I do that, I end up at this error.
I'm getting this issue too. Not sure exactly why it's triggering, but I do notice there are two load_config functions:
/usr/local/lib/python2.7/dist-packages/docker/auth/auth.py:def load_config(config_path=None):
/usr/local/lib/python2.7/dist-packages/docker/auth.py:def load_config(config_path=None, config_dict=None):
Looking at the names of the files and directories I wonder if there is an importing order difference that causes it for some people to import the wrong module?
Also, this is the output of pip freeze:
docker==3.4.1
docker-compose==1.22.0
docker-py==1.10.6
Apparently docker is the replacement for docker-py, but does not conflict with it, so they simply install over each other. To fix this you have to uninstall both of them, then install just the right one. (And hope other pypi modules don't pull the old module).
Apparently docker is the replacement for docker-py, but does not conflict with it, so they simply install over each other.
I hit this running docker-compose after an upgrade of docker-compose, and filed https://github.com/docker/compose/issues/6339 there. Seems worth preventing that failure mode.
Issue with airflow 2.1.0 was that it had some compatibility issues with python 3.8 even though Airflow suggests that it works fine with python 3.8, I switched to fresh python 3.6 installation and everything worked fine.
Most helpful comment
I'm getting this issue too. Not sure exactly why it's triggering, but I do notice there are two load_config functions:
Looking at the names of the files and directories I wonder if there is an importing order difference that causes it for some people to import the wrong module?
Also, this is the output of pip freeze:
Apparently docker is the replacement for docker-py, but does not conflict with it, so they simply install over each other. To fix this you have to uninstall both of them, then install just the right one. (And hope other pypi modules don't pull the old module).