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

  • 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:closed
  • Created a year ago
  • Reactions:6
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
finswimmercommented, Sep 3, 2022

Thanks a lot for these information @jacopok 👍 I try to have a look on this in the next week.

1reaction
Saelyoscommented, Sep 26, 2022

I had a similar problem and it seems to come from the file ~/.cache/pypoetry/virtualenvs/envs.toml/ Removing ~/.cache/pypoetry/ solved my issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration | master | Documentation | Poetry - Python ...
virtualenvs.create #. Type: boolean. Default: true. Create a new virtual environment if one doesn't already exist.
Read more >
Where to locate virtual environment installed using poetry
venv (virtual environment) folder. To check if virtual environment is there, we use the following command:- poetry config virtualenvs.in-project
Read more >
Quick Start for Contributors - Apache SkyWalking
Or try: virtualenvs.prefer-active-python , which is an experimental poetry feature that can be set to true so that it will automatically follow environment....
Read more >
poetry: Versions - Openbase
Fix an issue where poetry env info did not respect virtualenvs.prefer-active-python (#6986). Fix an issue where poetry env list does not list the...
Read more >
tox-poetry-installer - Python Package Health Analysis - Snyk
A plugin for Tox that lets you install test environment dependencies from the Poetry lockfile For more information about how to use this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found