1

I'm creating a docker that includes the following:

FROM debian:jessie
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list  # Now archived
RUN apt-get update && apt-get install -y python python-pip

Which prints the following

Setting up python-urllib3 (1.9.1-3+deb8u1) ...
Setting up python-pip (1.5.6-5) ...

In the docker, pip fails with "No module named ordered_dict" from urllib3. The urllib3 version is known not to be supported (which makes me wonder why it's in a "stable" release.)

jeff@Builder:~$ python
Python 2.7.9 (default, Sep 14 2019, 20:00:08) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib3
>>> urllib3.__version__
'1.25.9'

The correct version of urllib3 is 1.23, according to https://github.com/urllib3/urllib3/issues/1456 .

How do I create a docker without this issue?

How to I find out which version of python-pip (or python-urllib3) to install to avoid this?

And most importantly, how can I figure this out for myself, next time?

Note that this is not quite a duplicate of Pip does not work on linux returning error:"from urllib3.packages.ordered_dict import OrderedDict ImportError: No module named ordered_dict" , since this has a repro and involves docker, and the answer there solves having an older version of urllib3, which is not the problem here.

1 Answer 1

3

I seem to have blundered into an answer: apt-get install python-pip-whl

FROM debian:jessie
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list  # Now archived
RUN apt-get update && apt-get install -y python python-pip-whl python-pip

No idea why it works. The version of urllib3 doesn't change. If anyone can post a more illuminating answer I will select it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .