Skip to content

Instantly share code, notes, and snippets.

@jonatanblue
Last active July 18, 2019 12:15
Show Gist options
  • Save jonatanblue/e6c319aa95673eaf8acc475f92e961d5 to your computer and use it in GitHub Desktop.
Save jonatanblue/e6c319aa95673eaf8acc475f92e961d5 to your computer and use it in GitHub Desktop.
Resolve docker-py older version naming conflict

Problem

When running docker-compose I get this error:

docker-compose --version
> ERROR: Dependency conflict: an older version of the 'docker-py' package is polluting the namespace. Run the following command to remedy the issue:
> pip uninstall docker docker-py; pip install docker

Following the instructions in the error message does not help.

Cause

The Python library for Docker was renamed from docker-py to docker. This caused a naming conflict, as stated in the error message, which prevents docker-compose from functioning properly.

Solution

On both Ubuntu 14.04 and Mac OS I had to do the following to resolve the issue:

# Find out where docker is installed:
python -c "import docker; print(docker.__path__)"
> ['/usr/local/lib/python2.7/site-packages/docker']

# Find the folder with (old) docker_py files
file /usr/local/lib/python2.7/site-packages/docker_py*
> /usr/local/lib/python2.7/site-packages/docker_py-1.8.0.dist-info: directory

# (Re-)move the directory
mv /usr/local/lib/python2.7/site-packages/docker_py-1.8.0.dist-info /tmp/

# Docker Compose is now working
docker-compose --version
> docker-compose version 1.11.2, build dfed245

Thanks

Thanks to @stephenpascoe for finding this solution.

@danaszova
Copy link

Thanks, this saved me as well @stephenpascoe!

@denielaa
Copy link

it works. nice. thanks

@rverli
Copy link

rverli commented Mar 10, 2018

@shudipta
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment