Compose: pkg_resources.VersionConflict: (requests 2.2.1 (/usr/lib/python2.7/dist-packages), Requirement.parse('requests>=2.5.2'))

Created on 17 Apr 2015  路  13Comments  路  Source: docker/compose

version 1.2.0

docker-compose run blah

Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2749, in <module>

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 446, in _build_master
    equal ``sys.path``.)
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 459, in _build_from_requirements

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 632, in resolve
    error_info = {}
pkg_resources.VersionConflict: (requests 2.2.1 (/usr/lib/python2.7/dist-packages), Requirement.parse('requests>=2.5.2'))
arepackaging kinquestion

Most helpful comment

sudo pip install --upgrade docker-compose fixes it

All 13 comments

sudo pip install --upgrade docker-compose fixes it

I guess I'll leave it open in case you need to do something on your end :smile:

To fix the issue run

pip install requests==2.5.3 && pip install docker-compose

Thanks @scotty-c, I had the same error and the problem was I had requests 2.2.1 installed.

After specifying requests==2.5.3 it worked for me.

sudo pip install --upgrade docker-compose fixes it
works for me

This is still a real problem. By pinning the exact version of requests in setup.py, you prevent anyone from running docker-compose on a system with an upgraded version. For instance, at this time setup.py requires requests < 2.7, when the latest available version is 2.7 So anyone who wants to run the latest version of the requests library on a system with docker-compose... can't. In my testing docker-compose is very much compatible with requests 2.7 So instead of forcing a certain version of that library, it might be nicer to just say "requests >= 2.6.1" or whatever the lowest working version is. Then in the README list the tested version for people who care.

pkg_resources.DistributionNotFound: The 'requests<2.7,>=2.6.1' distribution was not found and is required by docker-compose
$ pip show requests

Metadata-Version: 2.0
Name: requests
Version: 2.7.0

If you're installing using pip, I would highly recommend using a virtualenv, it removes issues like this by isolating the python packages from each other. You can either symlink (or alias) venv/bin/docker-compose or add venv/bin/ to $PATH

@dnephin We no longer use virtualenv on our systems because we moved to docker. It seems kind of silly to me to have to activate a virtualenv to run docker-compose commands. Especially since we run them from puppet which complicates using virtualenv.

If you were to install docker-compose in a container then you wouldn't run into this issue, right? Unless you're installing other things as system packages.

It's always a good idea to use a virtualenv if you have more than a single application on the "host" (it doesn't matter if it's a real host or a container).

There really isn't anything else we can do here. Our requirements are correct, and we'd have many issues with the requests package in the past, so relaxing the requirements here is not really an option.

If you don't want to use virtualenv, you could always run compose in a container (#1806)

Met almost the same problem.
Finally sudo pip install --upgrade distribute saved my day.

try every step above, still got this issue

pkg_resources.DistributionNotFound: The 'requests!=2.11.0,<2.12,>=2.6.1' distribution was not found and is required by docker-compose

Updates:

I fix with below steps:

pip install virtualenv
virtualenv env
source env/bin/activate
wget https://raw.githubusercontent.com/docker/compose/master/requirements.txt
pip install -r requirements.txt

Now you should be fine to run docker-compose.

The file at https://raw.githubusercontent.com/docker/compose/master/requirements.txt specifies requests==2.11.1. Yet when I run docker-compose I get this error ("pkg_resources.DistributionNotFound: The 'requests<2.8,>=2.6.1' distribution was not found and is required by docker-compose"). I'm running Version 17.03.1-ce-mac5 (16048) for OS X and running docker-compose from a (Py 3.5) virtual environment with the contents of requirements.txt installed. I've tried pip install requests==2.7 but still get the same error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidbarratt picture davidbarratt  路  3Comments

CrimsonGlory picture CrimsonGlory  路  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments

bitver picture bitver  路  3Comments

bergtwvd picture bergtwvd  路  3Comments