-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
poetry env info
does not respect virtualenvs.prefer-active-python = true
setting
#5947
Comments
Hello @nirvana-msu, can you please give an example about the output you see and the one you would expect? fin swimmer |
Try installing poetry from the
curl -sSL https://install.python-poetry.org | python - --uninstall
rm -rf .cache/pypoetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - and let us know if something changes |
@finswimmer I have encountered the same issue, so I can give an example of unexpected behavior. Setup My system python is 3.9.11, as is the python
I take the following [tool.poetry]
name = "example_project"
version = "0.0.1"
description = "Demonstrating an issue."
license = "GNU GPL3"
authors = ["Jacopo Tissino <[email protected]>"]
[tool.poetry.dependencies]
python = ">=3.7,<3.8"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" Then (to start, I'll also show the outcome of setting it to true later), I set $ poetry config virtualenvs.prefer-active-python false Then, I run
Creating the (wrong) virtualenv Now, (without knowing about the prefer-active-python setting) I'd expect poetry to be using the current python, so that I could run
while, instead, I see this weird warning: the currently activated python is not 3.9.11! Incidentally, in the virtualenv's folder I find the unexpected structure: Now, if I try to enter a poetry shell I can spot the problem:
To relate to the
Alternatively, I can run
which is slightly more informative (why do we need to wrap a poetry command with poetry run, though?). Experimental option on If I repeat all the previous procedure with
but indeed, the
while, as @nirvana-msu noted,
This behavior does feel inconsistent to me, but let me know if I've missed anything! |
Thanks a lot for these information @jacopok 👍 I try to have a look on this in the next week. |
I second this, it is not working as expected |
I had a similar problem and it seems to come from the file |
Similarly, I ran into this issue (on mac) & resolved it by removing |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 avirtualenvs.prefer-active-python
setting which defaults tofalse
- so has to be set totrue
to use Poetry withpyenv
. While that fixes e.g.poetry install
,poetry env info
still ignorespyenv
even with this setting. To get it to provide information about my actual venv I had to wrap the call withpoetry 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 tofalse
is such an incredible gotcha. I would think the vast majority of (linux) users would use Poetry alongsidepyenv
(and everyone was usingget-poetry.py
installer in the past as it was the recommended one), and this will get them all.The text was updated successfully, but these errors were encountered: