urllib3 version conflict
See original GitHub issuessladapter.py
makes an attempt to import urllib3
from requests
and if it fails, attempts to import urllib3
directly – see https://github.com/docker/docker-py/blob/453964466741a1c85fc420c8b40fb5710f40b017/docker/transport/ssladapter.py#L10-L13. This may result in an older version of urllib3
being used at runtime. For example, the line at https://github.com/docker/docker-py/blob/453964466741a1c85fc420c8b40fb5710f40b017/docker/transport/ssladapter.py#L22 fails for versions of urllib3
before version 1.8 with the following exception:
AttributeError: 'module' object has no attribute 'connection'
Proposal for resolution: Specify urllib3>=1.8
in requirements.txt
and setup.py
, import directly from urllib3
rather than import from the version bundled w/ requests
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
The conflict is caused by: The user requested urllib3==1.26 ...
ERROR: Cannot install -r requirements.txt (line 16) and urllib3==1.26 because these package versions have conflicting dependencies.
Read more >Conflicting dependencies: user requested urllib3==1.26.5 ...
5 because these package versions have conflicting dependencies. The conflict is caused by: The user requested urllib3==1.26.5 requests 2.20.0 ...
Read more >Managing Python Dependencies with Requirements.txt
The required dependencies for urllib3 can be seen below. ... This ensures that most version conflicts will be avoided, but as mentioned ...
Read more >urllib3 1.1 - PyPI
urllib3 1.1. pip install urllib3==1.1. Copy PIP instructions. Newer version available (1.26.13). Released ...
Read more >Hynek Schlawack on Twitter: "requests is a GREAT project for ...
... but its strict version pins (including urllib3<1.27 & effectively charset_normalizer>=2.0,<=2.1) are a major version conflict PITA if it gets pulled ...
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
This honestly is an issue with Ubuntu and its stubbornness with messing with the packaging / bundling of certain Python libraries.
I won’t add
urllib3
to ourrequirements.txt
becauseurllib3
is not a requirement of the docker SDK -requests
is.If you decide (or your OS decides) to use older versions of libraries than the ones we indicate and test our software with, you have to accept the consequences of those choices and the extra work it might entail. We have made reasonable concessions to support a wide range of setups (i.e. fallback on
urllib3
import whenrequests.packages.urllib3
is unfortunately absent), but none that would compromise the quality of the software for the majority of users.You may solve this issue by using
virtualenv
, or using a more recent version of Ubuntu.Thanks for looking into this and I appreciate the consideration. I understand it’s a bit of a corner case, but the reason I brought it up is wrapping the
requests
import in atry...except ImportError
block produces a bit of a red herring, resulting in some unnecessary confusion.In my case, I’m not using
docker-py
, but the official docker formula attempts to install it by default. At the very least, this suggestion is informed by the maxim Explicit is better than implicit.