compose icon indicating copy to clipboard operation
compose copied to clipboard

'requests' version conflict

Open blackrosezy opened this issue 11 years ago • 11 comments

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']))

blackrosezy avatar Feb 03 '15 03:02 blackrosezy

To check conflict

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

blackrosezy avatar Feb 03 '15 03:02 blackrosezy

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

Starefossen avatar Feb 03 '15 19:02 Starefossen

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

$ git clone [email protected]: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 .

blackrosezy avatar Feb 03 '15 19:02 blackrosezy

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

pip uninstall requests
pip install requests==2.4.3

Starefossen avatar Feb 03 '15 20:02 Starefossen

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

dnephin avatar Feb 04 '15 15:02 dnephin

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

mattva01 avatar Feb 04 '15 21:02 mattva01

@Starefossen

pip uninstall requests
pip install requests==2.4.3

Requested requests==2.4.3, but installing version 2.6.0

Glideh avatar Mar 17 '15 10:03 Glideh

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

marceloandrader avatar Mar 17 '15 21:03 marceloandrader

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

Glideh avatar Mar 18 '15 06:03 Glideh

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

kumarit avatar Aug 14 '17 09:08 kumarit

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'})

rajnishcoder avatar Nov 27 '17 12:11 rajnishcoder