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.

Unexpected behavior with PIPENV_USE_SYSTEM and PIPENV_IGNORE_VIRTUALENVS

See original GitHub issue

In my shell environment, I am seeing behavior I would not expect. I’ve been able to correct the behavior by setting PIPENV_IGNORE_VIRTUALENVS, but why I have to is really confusing me.

I am using pyenv for managing Python versions only (no funny virtualenv management, this is why I want to use pyenv). I’ve configured my shell to ensure pyenv doesn’t sit in-front of the virtual environment’s bin path. I understand this can be accomplished with PIPENV_SHELL_COMPAT, but I am effectively doing the same thing and confirmed it is working correctly.

That aside, when I cd to my project and run pipenv install --verbose I see it choose the correct pip path (the pip in the environment for the project). Then I used pipenv shell and at some point realized I needed to install another dependency so naturally I ran pipenv install -d flake8. This invocation is using my system pip. This was completely unexpected. After digging around I found that the basis of this decision is in how PIPENV_USE_SYSTEM is set. If the environment variable VIRTUAL_ENV has a value it will use the system pip (or more precisely the pip in the environment where pipenv is installed). To further complicate matters, the comment above PIPENV_USE_SYSTEM confused me:

Tells Pipenv to use the virtualenv-provided pip instead.

which leads me to think that pipenv must be installed in each virtual environment?

I am not quite sure what the solution is, but I feel there is at least a documentation change needed somewhere. The fact that setting PIPENV_IGNORE_VIRTUALENVS actually lets me respect the the virtual env is backwards.

Thank you for pipenv and I am looking forward to continuing to use it! Great work!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:50 (34 by maintainers)

github_iconTop GitHub Comments

3reactions
brosnercommented, Sep 16, 2017

Wow, love that pyenv feature! Thanks @kennethreitz 😃

1reaction
brosnercommented, Sep 17, 2017

Confirmed. Thank you @kennethreitz.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv install giving Failed to load paths errors - Stack Overflow
How I solved is : When I run pipenv shell to create a new virtual environment, just add option --three or --two to...
Read more >
pipenv Documentation - Read the Docs
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the. Python...
Read more >
Pipenv — Dan's Cheat Sheets 1 documentation
(Set PIPENV_IGNORE_VIRTUALENVS to disable that behavior.) Pipenv generates a name for each virtualenv based on the project directory path and a hash. So...
Read more >
pipenv Documentation - manpages.ubuntu!
While pip can install Python packages, Pipenv is recommended as it's a higher-level tool that simplifies dependency management for common use cases. Use...
Read more >
Advanced Usage of Pipenv — pipenv 7.7.9 documentation
--dev — Install both develop and default packages from Pipfile.lock . · --system — Use the system pip command rather than the one...
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