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.

pipenv install --deploy --system doesn't respect PIP_IGNORE_INSTALLED=1 in 2020.8.13

See original GitHub issue

Issue description

When requesting pip to install in user mode, and also to ignore any installed packages, (PIP_USER=1 PIP_IGNORE_INSTALLED=1) pipenv will still skip system installed packages if they meet the requirements. This worked fine in 2020.6.2.

While this use case might seem a bit obscure at first, it’s a great way to install and generate local wheels in a multi-step Dockerfile ensuring that everything is included in a single folder that can easily be copied over to a minimal python image.

Expected result

I expect all packages to be installed in the expected location, regardless of if they exist at the system level, when PIP_IGNORE_INSTALLED is set.

Actual result

Any system package meeting the requirements are skipped and not installed.

Steps to replicate

I’m using Docker here to avoid contaminating the local user installation, but the same happens outside of Docker.

In a new folder, run pipenv install six to create a Pipfile with six as the only dependency.

Using this Dockerfile in the same folder, run docker build . -t test

FROM python:3.7-buster
WORKDIR /build
# System install, which includes six
RUN pip install pipenv==2020.8.13

COPY Pipfile* ./
RUN env PIP_USER=1 PIP_IGNORE_INSTALLED=1 pipenv install --deploy --system

Use docker run --rm -ti test /bin/bash and verify that six.py has not been installed into /root/.local in the container.

To verify that this is not something pip does, add the following line at the end of the Dockerfile, repeat the steps above, and notice that it correctly installs six in /root/.local

RUN env PIP_USER=1 PIP_IGNORE_INSTALLED=1 pip install six

(This is the equivalent of running pip install --user --ignore-installed six)

Workaround

Using the previous version 2020.6.2 of pipenv solves the problem form now.

RUN pip install pipenv==2020.6.2

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
judgeaxlcommented, Sep 4, 2020

If so, it’s probably good to update the final part of this section of the documentation to be more clear what pip environment variables are supported and which aren’t.

https://pipenv.pypa.io/en/latest/advanced/#configuration-with-environment-variables

Excerpt:

Also note that pip itself supports environment variables, if you need additional customization.

For example:

$ PIP_INSTALL_OPTION="-- -DCMAKE_BUILD_TYPE=Release" pipenv install -e .
Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv Documentation - Read the Docs
--dev — Install both develop and default packages from Pipfile. • --system — Use the system pip command rather than the one from...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
☤ Pipenv does not respect pyenv's global and local Python versions¶. Pipenv by default uses the Python it is installed against to create...
Read more >
Advanced Usage of Pipenv - Python Packaging Authority
Deploying System Dependencies¶. You can tell Pipenv to install a Pipfile's contents into its parent system with the --system flag:.
Read more >
Why is Pipenv not picking up my Pyenv versions?
maybe it also doesn't respect pyenv shell. I usually do what you did, specify the python like pipenv install --python 3.7.
Read more >
pipenv · PyPI
These are intended to replace $ pip install usage, as well as manual virtualenv management (to activate a virtualenv, run $ pipenv shell...
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