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 --two always deletes virtualenv

See original GitHub issue

I want to make a small script that automates running something that needs python2 with pipenv. I would do:

pipenv install --two
pipenv run hello.py

The first invocation is fine, the second time I run this script however it says:

Virtualenv already exists!
Removing existing virtualenv...
Creating a virtualenv for this project...

even though nothing has changed. It’s the --two option that causes this. If I remove that option it behaves as I would expect and reuses the old virtualenv, however then I get python3.

Since python3 is the default you don’t need --two/–three, so then you don’t have this problem.

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
audiolioncommented, Oct 27, 2017

I guess what I wanted to happen was say pipenv install on my CI server and have a way to ensure it chooses the correct version of python, if the env didnt exist it might grab the system version first because it finds it on the path first, which is bad, but if a virtualenv already exists with that version, I don’t want it to destroy it. With the existing behaviors I am not sure how to make that happen.

4reactions
iandanforthcommented, Nov 7, 2017

I’d like to second the intuition that even explicit arguments won’t repeat work unnecessarily.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove a virtualenv created by "pipenv run"
You can run the pipenv command with the --rm option as in: pipenv --rm. This will remove the virtualenv created for you under...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
The workaround is to set the following two environment variables to a standard localization format: LC_ALL; LANG. For Bash, for example, you can...
Read more >
Manage Virtual Environments - menziess blog
This way you always delete the virtual environment along with your project when you're done. And the python installation can easily be selected...
Read more >
pipenv Documentation
Pipenv uses two files to do this: Pipfile and Pipfile.lock (which will look ... Will create a virtual env and install dependencies (if...
Read more >
Pipenv: Sacred Marriage of Pipfile, Pip, & Virtualenv
lock instead, which is superior for basic use cases. Hashes are used everywhere, always. Security. Install Pipenv Today!¶. $ pip install pipenv ✨...
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