docker-py: Getting TypeError while calling docker.from_env() in v3.1.2

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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 5
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

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

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'

@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.

Works now. Thanks for the quick response!

works for me at least, thanks