There is a problem with the just-released version 3.1.2:
$ pip list docker | grep docker
docker (3.1.2)
$ python -c 'import docker; docker.from_env()'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/.../env/lib/python2.7/site-packages/docker/client.py", line 81, in from_env
**kwargs_from_env(**kwargs))
File "/Users/.../env/lib/python2.7/site-packages/docker/client.py", line 38, in __init__
self.api = APIClient(*args, **kwargs)
File "/Users/.../env/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'
exit code 1
Looks like the public wheel package was built incorrectly. There are two conflicting definitions:
```
$ wget https://pypi.python.org/packages/41/e9/a41d58413cdedf7de0faf98f8681cd1810611a9a3826891fc05df165a2ff/docker-3.1.2-py2.py3-none-any.whl#md5=502ebdf82fee5c0f337ff9ed8ab5f0f6
$ tar xf docker-3.1.2-py2.py3-none-any.whl
$ grep -R 'def load_config' docker
docker/auth.py:def load_config(config_path=None, config_dict=None):
docker/auth/auth.py:def load_config(config_path=None):
Right, that's not supposed to happen. Thanks for the report - I'll take a look ASAP.
removing the "auth" directory and leaving auth.py worked for me
Yeah it's my fault, the wheel got packaged using a build directory that had some stale files in it. Will be fixed by #1969
@marpetr Let me know if you're still seeing the issue with 3.1.3
works for me at least, thanks
Works now. Thanks for the quick response!
This bug is shown again in 3.1.4?
Docker version 17.12.0-ce, build c97c6d6
โ ~se_docker git:(master) โ docker-compose up -d
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 71, in main
command()
File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 124, in perform_command
project = project_from_options('.', options)
File "/usr/local/lib/python2.7/site-packages/compose/cli/command.py", line 41, in project_from_options
compatibility=options.get('--compatibility'),
File "/usr/local/lib/python2.7/site-packages/compose/cli/command.py", line 121, in get_project
host=host, environment=environment
File "/usr/local/lib/python2.7/site-packages/compose/cli/command.py", line 92, in get_client
environment=environment, tls_version=get_tls_version(environment)
File "/usr/local/lib/python2.7/site-packages/compose/cli/docker_client.py", line 120, in docker_client
client = APIClient(**kwargs)
File "/usr/local/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'
Confirmed 3.1.4 has the same problem. Downgrade to 3.1.3 is solved the issue.
I tried downgrading using pip install docker==3.1.3, but I'm still getting the same error message. Any other suggestions?
I'm pretty new at this.
I checked the 3.1.4 wheel and I can confirm it's clean. Try removing the old package and reinstalling with the --no-cache-dir option.
Hi -- I'm seeing the same error with a fresh install this evening, that started with 3.1.4:
$ pip list | grep docker
docker (3.1.4) [etc...]
$ python -c 'import docker; docker.from_env()'
[Traceback...]
TypeError: load_config() got an unexpected keyword argument 'config_dict'
then found this page, downgraded to 3.1.3 per above, and got the same error again:
[pip uninstall command...]
Successfully uninstalled docker-3.1.4
$ sudo pip install --no-cache-dir docker==3.1.3
Collecting docker==3.1.3
Downloading docker-3.1.3-py2.py3-none-any.whl (121kB)
100% |โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 122kB 603kB/s
Requirement already satisfied[etc...]
Successfully installed docker-3.1.3
$ python -c 'import docker; docker.from_env()'
[Traceback...]
TypeError: load_config() got an unexpected keyword argument 'config_dict'
I can wipe/reinstall (I'm writing an Ansible script for this machine) if needed to help diagnose, also open to me having fat fingered something, here. :)
@wjhill Ansible may be installing the deprecated docker-py package which conflicts with the docker package. Make sure you only have one or the other installed.
Removing docker-py allowed the "[...]docker.from_env()" command to run successfully with 3.1.4 installed.
I see where the Ansible Role I'm using installs docker-py; I'll put in an Issue with them about this, and point to this discussion, once I test locally.
Thanks!
Still getting the error when I use docker-compose and python -c 'import docker; docker.from_env()'.
[psudo@dedibox apache]$ docker-compose build --pull
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 71, in main
command()
File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 124, in perform_command
project = project_from_options('.', options)
File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 41, in project_from_options
compatibility=options.get('--compatibility'),
File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 121, in get_project
host=host, environment=environment
File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 92, in get_client
environment=environment, tls_version=get_tls_version(environment)
File "/usr/lib/python2.7/site-packages/compose/cli/docker_client.py", line 120, in docker_client
client = APIClient(**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'
[ice-92@dedibox apache]$
[ice-92@dedibox apache]$ python -c 'import docker; docker.from_env()'
Traceback (most recent call last):
File "<string>", line 1, in <module>
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'
[ice-92@dedibox apache]$
Not really sure what to do. I just need to get docker-compose to work.
Using docker 3.1.4, docker-py 1.10.6 and docker-compose 1.20.1. Does it matter what version of pip I use? My distro's version is 8.1.2 and I did upgrade it to 9.0.3 earlier using pip's upgrade feature, is it possible that caused any conflicts?
@ice-92 try removing docker-py, per what @shin- told me to do up above. I just confirmed that having only the latest docker (without the -py) Python package fixed my issue, hope it helps you too!
Alright, I somehow fixed it by doing
pip uninstall docker-py
pip uninstall docker-compose
pip install --upgrade --force-reinstall --no-cache-dir docker-compose
@ice-92 I got you. In fact, I just looked and confirmed that, at first, I got the same error after I removed it, too.
I thought it was just me...but I fixed it with pip uninstall docker, then running pip install --no-cache-dir docker again. After that, I ran OK.
Apologies, I assumed it was just a fluke on my system, but if that works for you it might just be how it has to be done in general.
Most helpful comment
Alright, I somehow fixed it by doing