Why does pipenv fail to install a package inside a docker container

To make a summary from comments :

The Problem exists because of the check condition in the wheel.py in pip sources. To resolve this problem there is already TODO comment added to sources.

TODO: This check fails if --no-cache-dir is set.

And yet we might be able to build into the ephemeral cache, surely?

Linkt at master provided intsco

but for future changes there is link to first appearnce of this TODO 1st detected.

Current solution :

as OP mentioned

comment the PIP_NO_CACHE_DIR=off


The behavior was a bug and should be fixed by upgrading to pip v19.0.1

https://github.com/pypa/pip/issues/6158#issuecomment-456814568


I had a similar problem during a build today. In my Dockerfile, which has python and pip preinstalled (I'm using python:3.6-slim-jessie docker image) I have the line pip install --upgrade setuptools pip and today my build failed because of the new version upgrade.

My Solution:

I commented the line pip install --upgrade setuptools pip in my Dockerfile.

Works fine now.

In your case, this problem occurs when virtualenv is created. During creation, it installs the latest versions of setuptools, pip, wheel (see the line: Installing setuptools, pip, wheel...done.). Downgrading to previous pip, wheel, setuptools versions will help.