Skip to content
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

uv-installed PyPy versions take precedence over non-uv CPython versions #7118

Closed
hynek opened this issue Sep 6, 2024 · 6 comments · Fixed by #7650
Closed

uv-installed PyPy versions take precedence over non-uv CPython versions #7118

hynek opened this issue Sep 6, 2024 · 6 comments · Fixed by #7650
Assignees
Labels
breaking A breaking change bug Something isn't working uv python Related to the uv python interface

Comments

@hynek
Copy link
Contributor

hynek commented Sep 6, 2024

uv 0.4.6 (84f25e8cf 2024-09-05)

I've been playing a bit with uv python and installed pypy3.9 with it and forgot about it.

Now, whenever I run uv venv --python python3.9 I get pypy3.9 instead. It just says Using Python 3.9.19.

My guess is that uv-installed Pythons take hard precedence, because uninstalling it starts giving me my proper Python 3.9 from homebrew, despite the fact I still have a pyp3.9 installed, too.

@hynek hynek changed the title uv-installed PyPy versions take precedence over Python versions uv-installed PyPy versions take precedence over non-uv CPython versions Sep 6, 2024
@zanieb
Copy link
Member

zanieb commented Sep 6, 2024

Hm yeah we'll use a managed Python over an unmanaged one. You think we should prefer the system CPython in this case? You can do --python cpython3.9 or --python cp39 to avoid getting PyPy. You can also use --python-preference system.

@zanieb zanieb added the uv python Related to the uv python interface label Sep 6, 2024
@hynek
Copy link
Contributor Author

hynek commented Sep 6, 2024

Hmmm, fair enough for me, but kinda surprising. I would've never expected to get a PyPy when asking for "Python 3.9". IDK, maybe I'm just set in my ways, by in my mind python3.9 is CPython and pypy3.9 is PyPy.

@zanieb
Copy link
Member

zanieb commented Sep 6, 2024

Yeah that makes sense. We should probably change the ordering, though it'll be a bit of a pain.

@zanieb zanieb added bug Something isn't working breaking A breaking change labels Sep 6, 2024
@henryiii
Copy link
Contributor

henryiii commented Sep 6, 2024

I would've never expected to get a PyPy when asking for "Python 3.9". IDK, maybe I'm just set in my ways, by in my mind python3.9 is CPython and pypy3.9 is PyPy.

I've argued this before too. :)

@zanieb
Copy link
Member

zanieb commented Sep 12, 2024

Oh I might be fixing this by accident while working on #7286 haha

@saucoide
Copy link

saucoide commented Sep 23, 2024

To add a datapoint, i'm just running into this and also found the behavior unexpected, especially because the output of a command depends on what other uv-managed pythons were previously installed

uv python install python3.8 pypy3.8
uv venv --python python3.8 .venv  # venv created with cpython 3.8

vs

uv python install pypy3.8
uv venv --python python3.8 .venv  # venv created with pypy 3.8

Also this produces different results whether run together or separately:

uv python install pypy3.8 python3.8  # installs both cpython & pypy

uv python install pypy3.8
uv python install python3.8  # wont install anything -> already found a 3.8 python pypy

zanieb added a commit that referenced this issue Sep 24, 2024
Closes #7118 

This only really affects managed interpreters, as we exclude alternative
Python implementations from the search path during the
`VersionRequest::executable_names` part of discovery.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking change bug Something isn't working uv python Related to the uv python interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants