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.

Python package partially installed in Docker with pip >= 7.0.0

See original GitHub issue

After a hard day troubleshooting my Docker deployment (django app), I finally found that latest version of pip (7.0.0 and 7.0.1) breaks the installation of Django inside Docker.

Don’t know how it’s related (or not), but pip install Django==1.3 works fine in a virtualenv, i.e I get all the files installed (a complete distribution):

(myenv):~/progs/argamato $ pip -V
pip 7.0.1 from /home/mathias/.virtualenvs/myenv/lib/python2.7/site-packages (python 2.7)

I can find the login.html template required on the admin page:

(myenv):~/.virtualenvs/myenv/lib/python2.7/site-packages $ find django \
  -name login.html
django/contrib/admin/templates/admin/login.html
django/contrib/auth/tests/templates/registration/login.html
django/contrib/flatpages/tests/templates/registration/login.html

while the same command run inside my Docker web container returns nothing:

root@9edf6692c07d:/src/argamato# pip -V
pip 7.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
root@9edf6692c07d:/src/argamato# find /usr/local/lib/python2.7/dist-packages/django \
    -name login.html
root@9edf6692c07d:/src/argamato#

Comparing size of deployed distribution is kind of fun too:

root@9edf6692c07d:/src/argamato# du -sh /usr/local/lib/python2.7/dist-packages/django
13M /usr/local/lib/python2.7/dist-packages/django

While the real uncompressed stuff takes a lot more (about 40MB).

Some investigations shows that uncompressing the cached tarball creates the django, Django-1.3.data and Django-1.3.dist-info directories:

root@9edf6692c07d:~# unzip .cache/pip/./wheels/87/59/82/4099bbbed04d9d048d7fd9d2284716df97998a2a2a1895674f/Django-1.3-py2-none-any.whl -d /tmp
root@9edf6692c07d:~# ls /tmp/
django  Django-1.3.data  Django-1.3.dist-info

My missing templates are in the /tmp/Django-1.3.data directory but pip install never deploys it in /usr/local/lib/python2.7/dist-packages/. Only django and Django-1.3.dist-info are available, thus the missing template files.

Anyway, that reminded me that my Docker installation was perfectly working a few days ago, so I switch back to pip 6.1.1 and BAM, problem solved…

Don’t you think of a regression bug here?

(BTW, pip 7.0.1 inside a virtuaenv inside a Docker container is broken too).

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
xavfernandezcommented, May 25, 2015

Yup, I’ve recently had a similar issue with django 1.4.3. This comes from the fact that installing these old versions of django from a .tar.gz or from a .whl wont produce the same install.

Since pip 7 installs everything through wheels (or at lease tries), you will have to explicitely tell it to stick to sdist:

pip install --no-binary django django==1.3
0reactions
hobbsdcommented, Jul 13, 2015

I had this problem when I upgraded Django from 1.4.20 to 1.4.21 and didn’t see a Django bug for it, so I filed one: https://code.djangoproject.com/ticket/25119

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't Install Python Package onto Docker - Stack Overflow
Use the following command to install in the docker container instead of in the base environment: pip install flake8.
Read more >
black · PyPI
Black is the uncompromising Python code formatter. ... Black can be installed by running pip install black . It requires Python 3.7+ to...
Read more >
Changelog - pip documentation v22.3.1
Only calculate topological installation order, for packages that are going to be installed/upgraded. This fixes an AssertionError that occurred when determining ...
Read more >
Is there a Docker image for PsychoPy? - Development
So, is it possible to run PsychoPy on Ubuntu using Docker? If this is indeed possible, I would very much appreciate instructions on...
Read more >
Installing Python Packages In Your Docker Container
However, because pip can only install Python packages, you may find yourself also having to use your package manager (i.e., apt-get install -y...
Read more >

github_iconTop Related Medium Post

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