`poetry env info` does not respect `virtualenvs.prefer-active-python = true` setting
See original GitHub issue-
I am on the latest Poetry version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption). -
OS version and name: WSL, Ubuntu 20.04
-
Poetry version: 1.2.0b1
Issue
I’m relying on pyenv to specify which base Python version Poetry should be using. It was incredibly confusing, coming from an old version of Poetry, to find out that there’s now a virtualenvs.prefer-active-python setting which defaults to false - so has to be set to true to use Poetry with pyenv. While that fixes e.g. poetry install, poetry env info still ignores pyenv even with this setting. To get it to provide information about my actual venv I had to wrap the call with poetry run (for it to pick up pyenv python correctly), i.e. poetry run poetry env info --path.
As a side note, this new prefer-active-python setting defauling to false is such an incredible gotcha. I would think the vast majority of (linux) users would use Poetry alongside pyenv (and everyone was using get-poetry.py installer in the past as it was the recommended one), and this will get them all.
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:7 (2 by maintainers)
Top Related StackOverflow Question
Thanks a lot for these information @jacopok 👍 I try to have a look on this in the next week.
I had a similar problem and it seems to come from the file
~/.cache/pypoetry/virtualenvs/envs.toml/Removing~/.cache/pypoetry/solved my issue.