Christopher:example_pip_dir christopher$ pipenv --rm
No virtualenv has been created for this project yet!
Aborted!
Christopher:example_pip_dir christopher$ pipenv --python 2.7
Virtualenv already exists!
Removing existing virtualenv…
Creating a virtualenv for this project…
Pipfile: /Users/christopher/example_pip_dir/Pipfile
Using /usr/local/bin/python (2.7.16) to create virtualenv…
⠴ Creating virtual environment...Already using interpreter /usr/local/opt/python@2/bin/python2.7
New python executable in /Users/christopher/.local/share/virtualenvs/example_pip_dir-WYuRpNkV/bin/python2.7
Also creating executable in /Users/christopher/.local/share/virtualenvs/example_pip_dir-WYuRpNkV/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /usr/local/bin/python
✔ Successfully created virtual environment!
Virtualenv location: /Users/christopher/.local/share/virtualenvs/example_pip_dir-WYuRpNkV
Creating a Pipfile for this project…
This is what's happening:
example_pip_dir
. I entered inside the folder and created a new pipenv --python 2.7
.rm -rf example_pip_dir
pipenv --rm
. It tells me that no virtual environment has been created for this project.pipenv --python 2.7
. It tells me that a virtual environment exists for this project and goes ahead and installs it.What is this inconsistency? Either, the virtual environment for the project exists or not. It's as if for each command, they would check for different things when checking for the virtual environment.
It should be consistent and this is not.
Am I doing something wrong?
This is crucial for me, because most of this is running on a CI (Continuous Integration) System, therefore I can't have these inconsistencies, because users might delete their whole project directory for sanitation and many other reasons really.
Inside the CI is even worst, because it even prompts me if I want to delete it or not, freezing the worker from doing anything else until someone adds yes or no. Kind of annoying too. It might be because it's running under another virtual environment itself the agent.
The answers for this problem was to set the environment variable:
PIPENV_YES=True
https://pipenv.kennethreitz.org/en/latest/advanced/#pipenv.environments.PIPENV_YES
If set, Pipenv automatically assumes “yes” at all prompts. Default is to prompt the user for an answer if the current command line session if interactive.