question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

urllib3 version conflict

See original GitHub issue

ssladapter.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:open
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
shin-commented, Mar 27, 2017

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 our requirements.txt because urllib3 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 when requests.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.

0reactions
oxtopuscommented, Mar 28, 2017

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 a try...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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found