python-poetry / python-poetry/poetry

(🐞) `env use system` outputs an incorrect/confusing message "Deactivating virtualenv"

Open
#7,147 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/venv kind/question
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

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 (-vvv option) 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>.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up β€” it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing poetry env use system while a virtual environment is active, then compare its output with poetry env info before and after the command. Trace the command's deactivation message and determine what wording accurately reflects the environment selection; done means the output is no longer misleading and the behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.