Repository navigation
Open
Labels
area/venvRelated to virtualenv managementRelated to virtualenv managementkind/questionUser questions (candidates for conversion to discussion)User questions (candidates for conversion to discussion)
Description
- Poetry version: 1.2.2
- Python version: 3.11.0
- OS version and name: Windows 21H2
- pyproject.toml: nah
- [π] I am on the latest stable Poetry version, installed using a recommended method.
- [π] I have searched the issues of this repo and believe that this is not a duplicate.
- [π] I have consulted the FAQ and blog for any relevant entries or release notes.
- [π] If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
poetry env use system(when a venv is active) has a confusing message in the output that looks incorrect.
π poetry env info
Virtualenv
Python: 3.10.8
Implementation: CPython
Path: C:\Users\AMONGUS\projects\test\.venv
Executable: C:\Users\AMONGUS\projects\test\.venv\Scripts\python.exe
Valid: True
System
Platform: win32
OS: nt
Python: 3.10.8
Path: C:\Users\AMONGUS\AppData\Local\Programs\Python\Python310
Executable: C:\Users\AMONGUS\AppData\Local\Programs\Python\Python310\python.exe
π poetry env use system
Deactivating virtualenv: C:\Users\AMONGUS\AppData\Local\pypoetry\Cache\virtualenvs\test-aYKTyqIq-py3.11
π $Env:VIRTUAL_ENV; py -0p
C:\Users\AMONGUS\AppData\Local\pypoetry\Cache\virtualenvs\test-aYKTyqIq-py3.11
* C:\Users\AMONGUS\AppData\Local\pypoetry\Cache\virtualenvs\test-aYKTyqIq-py3.11\Scripts\python.exe
-V:3.11 C:\Users\AMONGUS\AppData\Local\Programs\Python\Python311\python.exe
-V:3.10 C:\Users\AMONGUS\AppData\Local\Programs\Python\Python310\python.exe
π poetry env info
Virtualenv
Python: 3.11.0
Implementation: CPython
Path: C:\Users\AMONGUS\AppData\Local\pypoetry\Cache\virtualenvs\test-aYKTyqIq-py3.11
Executable: C:\Users\AMONGUS\AppData\Local\pypoetry\Cache\virtualenvs\test-aYKTyqIq-py3.11\Scripts\python.exe
Valid: True
System
Platform: win32
OS: nt
Python: 3.11.0
Path: C:\Users\AMONGUS\AppData\Local\Programs\Python\Python311
Executable: C:\Users\AMONGUS\AppData\Local\Programs\Python\Python311\python.exe
β HUUUUH β
Why did it output 'deactivating virtualenv', the active virtualvenv (poetry 3.11) is still active, and poetry env is now set to 3.11?
π poetry env use system
Deactivating virtualenv: C:\Users\AMONGUS\AppData\Local\pypoetry\Cache\virtualenvs\test-aYKTyqIq-py3.11
Is this supposed to mean something? or is this a defect and it shouldn't be showing?
TODO:
- raise another issue regarding the undefined behaviour when you do
poetry env use <path to venv>.
Reacted by DetachHead
Metadata
Metadata
Assignees
Labels
area/venvRelated to virtualenv managementRelated to virtualenv managementkind/questionUser questions (candidates for conversion to discussion)User questions (candidates for conversion to discussion)
Activity
neersighted commentedon Dec 6, 2022
What
poetry env usedoes is undefined here;poetry env use systemwithout an existing env andpoetry env use <path to venv>are undefined; this command is only meant to be with a 'real' Python. I believe we currently dereference virtual environments, and in general the behavior here is not validated or tested.We probably should either rename the command to be
poetry env createor figure out semantics for using it with virtual environments.The correct way to use an external virtual environment with Poetry is to activate it or manually set
VIRTUAL_ENV=/path/to/venv, and then use Poetry as normal.[-](π) `env use` says `Deactivating virtualenv` when it's actually not deactivating it[/-][+](π) `env use system` has undefied/unexpected behavior when a venv is active[/+]KotlinIsland commentedon Dec 6, 2022
@neersighted Ohhhhhh, that explains a lot...
I would expect that
env use systemwould always use the system version of python and never an active venv, WDYT?, comment below.dimbleby commentedon Dec 6, 2022
Could the documentation be clearer? Here's what the help text says
I don't myself see how that would encourage
poetry env use system, but if you want to propose a merge request to make things clearer I expect that would be welcomeKotlinIsland commentedon Dec 6, 2022
@dimbleby
env use systemis from the docs: https://python-poetry.org/docs/managing-environments/#switching-between-environmentsHmm, and upon reading that again, makes me think that it's supposed to do what I thought, I'll have to take another look at this...
[-](π) `env use system` has undefied/unexpected behavior when a venv is active[/-][+](π) `env use system` outputs an incorrect/confusing message "Deactivating virtualenv"[/+]KotlinIsland commentedon Dec 8, 2022
@neersighted Can you take another look at this please, I've changed the OP to focus on the part that looks incorrect.