docker-py: docker.from_env() causes TypeError: load_config() got an unexpected keyword argument 'config_dict'
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 “<stdin>”, 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’
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
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 16 (5 by maintainers)
Commits related to this issue
- Adds dependency to docker python module docker-py and docker both can not be installed on the same virtualenv. https://github.com/docker/docker-py/issues/1916#issuecomment-406639876 — committed to freedomofpress/securedrop by kushaldas 3 years ago
- Adds dependency to docker python module docker-py and docker both can not be installed on the same virtualenv. https://github.com/docker/docker-py/issues/1916#issuecomment-406639876 — committed to freedomofpress/securedrop by kushaldas 3 years ago
- Adds dependency to docker python module docker-py and docker both can not be installed on the same virtualenv. https://github.com/docker/docker-py/issues/1916#issuecomment-406639876 — committed to freedomofpress/securedrop by kushaldas 3 years ago
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).
You probably have old artifacts messing up your imports. Remove all
docker
anddocker-py
packages (inside/outside virtualenv) then reinstall.I am getting the same error in a pipenv virtualenv
under
Python 3.6.4
,Traceback
Here are my Pipfile and Pipfile.lock
dockapt.zip
UPDATE:
Downgrading to
docker==2.7.0
usingpipenv install "docker<3"
solves the issueYou 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:
what is docker-py, then?