You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
poetry recreates empty virtualenv with missing/broken $VIRTUAL_ENV and virtualenvs.in-project = null #4413
I've moved away .venv, which was pointed at by $VIRTUAL_ENV, and had run poetry install in a new shell already, where $VIRTUAL_ENV was not set anymore.
Running poetry show in the old shell with the non-existing $VIRTUAL_ENV resulted in:
% poetry show
The virtual environment found in …/project/.venv seems to be broken.
Recreating virtualenv project-EfzD9vF2-py3.9 in …/.cache/pypoetry/virtualenvs/project-EfzD9vF2-py3.9
…
Re-creating (or rather emptying) the existing virtualenv is not necessary in this case, and causes confusion when using poetry run foo then later, where foo gets used from the system, since it is not installed again yet in the virtualenv.
I think the idea with $VIRTUAL_ENV being used and virtualenvs.in-project = null is that it would be used in this case, but when $VIRTUAL_ENV points at something non-existing it should be considered to be unset (i.e. get ignored).
(I could also imagine that it would actually re-create it, but then it should re-create what VIRTUAL_ENV points at, since that is what is going to be used the next time around again.)
When using an invalid $VIRTUAL_ENV it causes the existing virtualenv to be re-created/emptied:
% VIRTUAL_ENV=/does/not/exist poetry install
The virtual environment found in /does/not/exist seems to be broken.
Recreating virtualenv test-poetry-EM-dhAoD-py3.9 in /home/user/.cache/pypoetry/virtualenvs/test-poetry-EM-dhAoD-py3.9
Installing dependencies from lock file
Activity
finswimmer commentedon Aug 27, 2021
Hello @blueyed,
unfortunately I cannot follow you, how to reproduce your issue. Could you please add a step-by-step description?
fin swimmer
blueyed commentedon Aug 27, 2021
Given a poetry managed project, e.g. with the following
pyproject.toml:Create/init it:
When using an invalid
$VIRTUAL_ENVit causes the existing virtualenv to be re-created/emptied:github-actions commentedon Apr 12, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.