-
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
virtualenvs.prefer-active-python is not respected #9278
Comments
Code is here Hard to see that going wrong, suggest put in some prints to see what is happening and submit a pull request when you figure it out! |
Similar issue on debian:
Note everything up until the last line says python3.12 and it is python3.11 after that. |
In my testing the problem is in
This indicates that venv is being passed a path for python, but, somehow, is ignoring it. |
It looks like there is no |
Well, there is a |
If a tool like asdf provides a python that is first in the path, virtualenv does not use it even though it is the one used to invoke poetry. Using --try-first-with (introduced in 20.3.0) allows poetry to point to the prefered python. See https://virtualenv.pypa.io/en/latest/changelog.html#v20-3-0-2021-01-10 fixes python-poetry#9278
But Are we passing an absolute path? Hard to tell above, looks like perhaps you have redacted the full path? If we are not, perhaps the better fix is to pass an absolute path as |
Even though |
If you have a reproducible example where |
Perhaps you are seeing some version of pypa/virtualenv#2285? It is indicated there that a pull request would be welcome. I'd add that virtualenv releases considerably more often than poetry does, so if you are keen to see a fix hit the wild - it'll almost surely happen faster there. |
Since you mentioned the absolute path being passed to |
I think I've found the source of my problem. It does not appear to have anything to do with the arguments. There was a leftover [virtualenv]
python = /usr/bin/python3.11 Removing this resolved my problems. |
No such file on my machine unfortunately, so it must be something else.
…On Sun, 26 May 2024 at 12:10, Mark A. Hershberger ***@***.***> wrote:
I think I've found the source of my problem. It does not appear to have
anything to do with the arguments.
There was a leftover ~/.config/virtualenv/virtualenv.ini containing
[virtualenv]python = /usr/bin/python3.11
Removing this resolved my problems.
—
Reply to this email directly, view it on GitHub
<#9278 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAOGWPPQ4MUM6EQ7XGW3S3ZEFAAVAVCNFSM6AAAAABF2DK7JKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZRHE3DQOBXGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Zaar
|
If a tool like asdf provides a python that is first in the path, virtualenv does not use it even though it is the one used to invoke poetry. Using --try-first-with (introduced in 20.3.0) allows poetry to point to the prefered python. See https://virtualenv.pypa.io/en/latest/changelog.html#v20-3-0-2021-01-10 fixes python-poetry#9278
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. |
Description
Good day,
I'm trying to make poetry use the currently active python provide by nix-shell but it still picks the one it was built with despite
virtualenvs.prefer-active-python = true
:You can see that the virtual env uses python
/nix/store/gd3shnza1i50zn8zs04fa729ribr88m9-python3-3.11.8/bin/python3.11
while the active python was/nix/store/kbgznx7akvi869qnnmhks820rhmgn66j-python3-3.11.8-env/bin/python
./nix/store/gd3shnza1i50zn8zs04fa729ribr88m9-python3-3.11.8/bin/python3.11
is the Python poetry was built with:Running
poetry -vvv shell
shows that it clearly fails to recognize currently active python properly:Workarounds
None I could find unfortunately.
Poetry Installation Method
System package manager
Operating System
Nixos 23.12
Poetry Version
1.8.2
Poetry Configuration
Python Sysconfig
Example pyproject.toml
Poetry Runtime Logs
The text was updated successfully, but these errors were encountered: