Compose: 'requests' version conflict

Created on 3 Feb 2015  路  11Comments  路  Source: docker/compose

docker-compose install the latest requests version (2.5.1) but docker-py expects requests version lower than 2.5.0.

docker-compose(fig)

https://github.com/docker/fig/blob/master/setup.py

install_requires = [
    ...
    'requests >= 2.2.1, < 3',
    'docker-py >= 0.6.0, < 0.8',
    ...
]

docker-py

https://github.com/docker/docker-py/blob/master/setup.py

install_requires = [
    ...
    'requests >= 2.2.1, < 2.5.0',
    ...
]

Here is the error message:

Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3018, in <module>
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 614, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 627, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 810, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (requests 2.5.1 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('requests<2.5.0,>=2.2.1'), set(['docker-py']))

Most helpful comment

Thanks for the tip @blackrosezy. Uninstalling requests and installing 芦valid禄 version also worked:

pip uninstall requests
pip install requests==2.4.3

All 11 comments

To check conflict

$ pip install pip-conflict-checker
$ pipconflictchecker
--------------------------------------------------
 Conflicts Detected
--------------------------------------------------
 - requests(2.5.1) docker-py(<2.5.0,>=2.2.1)

I get the same error. Are there any workarounds until a permanent fix is landed?

For a temporary workaround, you can clone docker-compose and update requests version in setup.py:

$ git clone git@github.com:docker/fig.git
$ cd fig

replace the string 'requests >= 2.2.1, < 3', to 'requests >= 2.2.1, < 2.5.0', in setup.py

and then run:
$ pip install .

Thanks for the tip @blackrosezy. Uninstalling requests and installing 芦valid禄 version also worked:

pip uninstall requests
pip install requests==2.4.3

docker-py should be updated to support newer versions, is there a corresponding ticket for that?

docker/docker-py#469 seems to address it.

@Starefossen

pip uninstall requests
pip install requests==2.4.3

Requested requests==2.4.3, but installing version 2.6.0

@Glideh I've had the same issue, I've hade to delete pip cache sudo rm -fr /tmp/pip-build-root

I also did that with no success.
pip install 'request<5' finally worked for me though.

ERROR: {"error": "Connection failed!\n\nThe error message returned was:\n(requests 2.17.3 (/home/upsilondata/venv/lib/python2.7/site-packages), Requirement.parse('requests==2.8.1'))"}
please reply, if you have any idea

If someone have any idea about this
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 862, in resolve
env = Environment([])

ContextualVersionConflict: (requests 2.13.0 (/usr/lib/python3.6/site-packages), Requirement.parse('requests<3.0.0dev,>=2.18.0'), {'google-api-core'})

Was this page helpful?
0 / 5 - 0 ratings