poetry
poetry copied to clipboard
`poetry shell` and `poetry run` access different pip instances
- [x] I am on the latest Poetry version.
- [x] I have searched the issues of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption).
- OS version and name: macOS Big Sur 11.6.4 (20G417)
- Poetry version: 1.1.13
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/itcarroll/f46c6dbc6f53da88e7715f877be41452
Issue
I'm getting different pip instances depending on whether I use poetry run pip or start a new shell with poetry shell. The correct one is poetry run pip. The pip that poetry shell uses is wrong, and is not even at the path given by which pip. A clue might be that poetry shell has an extra environment variable also pointing to the wrong venv: __PYVENV_LAUNCHER__=/Users/icarroll/.local/pipx/venvs/poetry/bin/python.
Starting in an empty directory containing only pyproject.toml, here's what I'm seeing:
% poetry install
Creating virtualenv bug-report-f5FbZAGT-py3.8 in /Users/icarroll/Library/Caches/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies... (0.1s)
Writing lock file
% poetry run pip --version
pip 22.0.3 from /Users/icarroll/Library/Caches/pypoetry/virtualenvs/bug-report-f5FbZAGT-py3.8/lib/python3.8/site-packages/pip (python 3.8)
% poetry shell
Spawning shell within /Users/icarroll/Library/Caches/pypoetry/virtualenvs/bug-report-f5FbZAGT-py3.8
Restored session: Tue Mar 8 18:54:56 EST 2022
% . /Users/icarroll/Library/Caches/pypoetry/virtualenvs/bug-report-f5FbZAGT-py3.8/bin/activate
(bug-report-f5FbZAGT-py3.8) % pip --version
pip 22.0.4 from /Users/icarroll/.local/pipx/shared/lib/python3.8/site-packages/pip (python 3.8)
(bug-report-f5FbZAGT-py3.8) % which pip
/Users/icarroll/Library/Caches/pypoetry/virtualenvs/bug-report-f5FbZAGT-py3.8/bin/pip