No module named docker
See original GitHub issueI’ve installed docker-py using sudo pip install docker-py. Here are my details:
$ pip freeze | grep docker-py && python --version && docker version
docker-py==1.5.0
Python 2.7.6
Client:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 05:37:18 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 05:37:18 UTC 2015
OS/Arch: linux/amd64
When I go into python and try to import it, I get:
>>> from docker import Client
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named docker
However, if instead I clone this repo and run the setup.py install, I can import docker. I guess there’s something different between the version in the PyPI and github?
Here’s the version information for the docker-py installation that works:
$ pip freeze | grep docker-py && python --version && docker version
docker-py==1.6.0-dev
Python 2.7.6
Client:
Version: 1.9.0
API version: 1.21
Go version: go1.4.2
Git commit: 76d6bc9
Built: Tue Nov 3 17:43:42 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.0
API version: 1.21
Go version: go1.4.2
Git commit: 76d6bc9
Built: Tue Nov 3 17:43:42 UTC 2015
OS/Arch: linux/amd64
Here’s my python version information:
$ python --version
Python 2.7.6
Issue Analytics
- State:
- Created 8 years ago
- Comments:19 (2 by maintainers)
Top Results From Across the Web
[Fixed] ModuleNotFoundError: No module named 'docker'
How to Fix “ModuleNotFoundError: No module named 'docker'” in PyCharm · Open File > Settings > Project from the PyCharm menu. · Select...
Read more >Failed to import docker or docker-py - No module named docker
The python3-docker module must be installed on the Target machine. I always tried to fix it on my local machine where the runbooks...
Read more >Ansible No module named 'docker' error - Bobcares
What causes no module named 'docker' error? ... Let us see what causes this error. Ansible uses python to deploy changes in the...
Read more >Fix ModuleNotFoundError (No Module Named docker) Python ...
In this tutorial I'll show you how to install and import docker package in your python program if you get ModuleNotFoundError no module...
Read more >ModuleNotFoundError: No module named 'docker'
ModuleNotFoundError: No module named 'docker' ... How to remove the ModuleNotFoundError: No module named 'docker' error? ... Hi,. In your python environment you ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To me it looks like that you install docker-py for python 2 and you are trying to import it in python 3. Or your
$PYTHONPATH
is misconfigured.EDIT: does any of these work?
I installed pip from the github repo (this is because I believe the debian package python-pip to be too out of date). Then used pip to install docker-py, i.e.: