How can I ignore the 'VIRTUAL_ENV' environment variable?
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
Issue
In my projects, I create the virtual environment in the project root ($ poetry config settings.virtualenvs.in-project true
) so that I can explicitly manage dependencies and cache them between builds.
Travis CI runs builds inside of its own virtual environment (thus sets VIRTUAL_ENV
).
The current logic consults VIRTUAL_ENV
before any other settings: https://github.com/sdispater/poetry/blob/ae1773d68f341c34d9124353f7a952d5fd3cfefb/poetry/utils/venv.py#L47-L50
How can I tell poetry
to ignore VIRTUAL_ENV
and always create a virtual environment?
pipenv
gets around this by adding another environment variable (PIPENV_IGNORE_VIRTUALENVS
). but I think poetry
can do better.
Proposal A
The default value of settings.virtualenvs.create
is inferred from VIRTUAL_ENV
(false
if set, true
if unset).
If the user runs $ poetry config settings.virtualenvs.create true
then poetry
will always create a virtual environment irrespective of VIRTUAL_ENV
.
Proposal B
Add settings.virtualenvs.ignore-active
to ignore VIRTUAL_ENV
when creating a virtual environment.
Proposal C
If settings.virtualenvs.in-project
is set and ./.venv/
does not exist then VIRTUAL_ENV
is ignored.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
@jacebrowning, run poetry while unsetting
VIRTUAL_ENV
:env -u VIRTUAL_ENV poetry
Now even though you are “Inside” an virtual environment, poetry won’t know about it.
Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.