Skip to content

Add uv python install --upgrade #9031

Closed

Description

@kevinrenskers
~ $ uv --version
uv 0.5.1 (Homebrew 2024-11-08)

When I run uv run --python 3.13 python then Python 3.13.0rc2 is started. Why it is still using the release candidate?

~ $ uv python list --only-installed
cpython-3.13.0-macos-aarch64-none       /opt/homebrew/opt/python@3.13/bin/python3.13 -> ../Frameworks/Python.framework/Versions/3.13/bin/python3.13
cpython-3.13.0rc2-macos-aarch64-none    .local/share/uv/python/cpython-3.13.0rc2-macos-aarch64-none/bin/python3.13
cpython-3.12.7-macos-aarch64-none       /opt/homebrew/opt/python@3.12/bin/python3.12 -> ../Frameworks/Python.framework/Versions/3.12/bin/python3.12
cpython-3.12.6-macos-aarch64-none       .pyenv/versions/3.12.6/bin/python3.12
cpython-3.12.6-macos-aarch64-none       .pyenv/versions/3.12.6/bin/python3 -> python3.12
cpython-3.12.6-macos-aarch64-none       .pyenv/versions/3.12.6/bin/python -> python3.12
cpython-3.11.10-macos-aarch64-none      .local/share/uv/python/cpython-3.11.10-macos-aarch64-none/bin/python3.11
cpython-3.10.15-macos-aarch64-none      .local/share/uv/python/cpython-3.10.15-macos-aarch64-none/bin/python3.10
cpython-3.9.6-macos-aarch64-none        /Library/Developer/CommandLineTools/usr/bin/python3 -> ../../Library/Frameworks/Python3.framework/Versions/3.9/bin/python

I had to run uv python uninstall 3.13 to get rid of the release candidate, and only then did uv run --python 3.13 python run the latest version - the one installed by Homebrew.

Shouldn't uv automatically use the final version over the release candidate? It feels strange that I had to manually install 3.13 for it to use the newer 3.13.

Activity

  1. charliermarsh commented on Nov 11, 2024

    @charliermarsh
    Member

    Was the release candidate already installed? Did uv python install 3.13 give you the release candidate after uninstalling?

  2. zanieb commented on Nov 11, 2024

    @zanieb
    Member

    Yeah we'll use a managed versions over system ones (like that homebrew one) and installed versions over available downloads. It looks like you previously used the release candidate — I think it's reasonable we don't switch the version out from under you without some sort of intervention?

  3. zanieb commented on Nov 11, 2024

    @zanieb
    Member

    (Arguably, we should automatically upgrade people to the latest patch version of Python somehow, but we do not do that now)

  4. kevinrenskers commented on Nov 11, 2024

    @kevinrenskers
    Author

    I had the release candidate installed back when that was the newest version, yeah. Since then Homebrew installed 3.13 because one of its packages demands it (I didn't manually brew install python 3.13).

    I expected that uv would pick that version.

    After running uv python uninstall 3.13 I then ran uv python install 3.13 and yes that gave me the newest version:

    ~ $ uv python list --only-installed
    cpython-3.13.0-macos-aarch64-none     /opt/homebrew/opt/python@3.13/bin/python3.13 -> ../Frameworks/Python.framework/Versions/3.13/bin/python3.13
    cpython-3.13.0-macos-aarch64-none     .local/share/uv/python/cpython-3.13.0-macos-aarch64-none/bin/python3.13
    cpython-3.12.7-macos-aarch64-none     /opt/homebrew/opt/python@3.12/bin/python3.12 -> ../Frameworks/Python.framework/Versions/3.12/bin/python3.12
    cpython-3.12.6-macos-aarch64-none     .pyenv/versions/3.12.6/bin/python3.12
    cpython-3.12.6-macos-aarch64-none     .pyenv/versions/3.12.6/bin/python3 -> python3.12
    cpython-3.12.6-macos-aarch64-none     .pyenv/versions/3.12.6/bin/python -> python3.12
    cpython-3.11.10-macos-aarch64-none    .local/share/uv/python/cpython-3.11.10-macos-aarch64-none/bin/python3.11
    cpython-3.10.15-macos-aarch64-none    .local/share/uv/python/cpython-3.10.15-macos-aarch64-none/bin/python3.10
    cpython-3.9.6-macos-aarch64-none      /Library/Developer/CommandLineTools/usr/bin/python3 -> ../../Library/Frameworks/Python3.framework/Versions/3.9/bin/python3
    

    To me it's weird that I had to do this manually.

    I think it's reasonable we don't switch the version out from under you without some sort of intervention

    Well, going from a release candidate to a final, when I never explicitly asked for a release candidate install anyway, seems reasonable.

    we should automatically upgrade people to the latest patch version of Python somehow

    That would make sense to me too.

  5. kevinrenskers commented on Nov 11, 2024

    @kevinrenskers
    Author

    How does one update the installed Python version anyway? Like, I did run uv python install 3.13 when the release candidate was still installed, and it did nothing. It didn't upgrade 3.13 to the final version.

    Or let's say 3.13.1 is released, how do I then update to that version? Will running uv python install 3.13 at that point update to 3.13.1? Or do I first have to uninstall 3.13? And what about all my Python projects with a .python-version file that says 3.13. Will they automatically update to 3.13.1 after I run uv python install 3.13? Do I have to specify the patch version in the .python-version file?

  6. my1e5 commented on Nov 11, 2024

    @my1e5
    Contributor

    let's say 3.13.1 is released, how do I then update to that version? Will running uv python install 3.13 at that point update to 3.13.1?

    If you already have 3.13.0 downloaded, then if you run uv python install 3.13 uv will detect that you already have a compatible Python installation that matches the requirement of 3.13 and therefore do nothing. With verbose mode enabled you can see this:

    $ uv -v python install 3.13
    DEBUG uv 0.5.1 (f399a5271 2024-11-08)
    DEBUG Found `cpython-3.13.0-macos-x86_64-none` for request `Python 3.13`
    

    So no, in this case it won't automatically fetch and download version 3.13.1. You would have to specifically state that you want uv python install 3.13.1 or use uv python install 3.13 --reinstall.

    $ uv -v python install 3.13 --reinstall
    DEBUG uv 0.5.1 (f399a5271 2024-11-08)
    DEBUG Ignoring match `cpython-3.13.0-macos-x86_64-none` for request `Python 3.13` due to `--reinstall` flag
    DEBUG Found download `cpython-3.13.1-macos-x86_64-none` for request `Python 3.13`
    

    If you run uv python uninstall 3.13 - which would trigger your all downloaded versions matching 3.13 to uninstall - then running uv python install 3.13 would the next time install 3.13.1 straight away. Because in this case it wouldn't find a compatible version meeting the requirement and therefore proceed to download the latest version.

    The same goes for your .python-version file. If it states 3.13, then uv will look and see what is the latest version of 3.13 you already have downloaded. It won't go and automatically download the latest version. It will just use whatever you already have if that's possible.

  7. charliermarsh commented on Nov 12, 2024

    @charliermarsh
    Member

    I think this looks like it's working correctly -- --reinstall or --upgrade should upgrade, but we shouldn't do it implicitly.

  8. kevinrenskers commented on Nov 12, 2024

    @kevinrenskers
    Author

    It would make sense to add --upgrade, because having to reinstall Python to update it feels pretty unintuitive.

    Personally I do feel that running uv python install 3.13 should install the latest patch version when an old version is installed, but I can see the logic in requiring --upgrade.

  9. changed the title [-]Python 3.13 is stuck on rc2[/-] [+]Add `uv python install --upgrade`[/+] on Nov 12, 2024
  10. charliermarsh commented on Nov 12, 2024

    @charliermarsh
    Member

    Sounds good. I honestly thought --upgrade existed already, but I was thinking of uv tool install.

  11. zanieb commented on Nov 12, 2024

    @zanieb
    Member

    I think we're waiting to add --upgrade until we have better behavior around upgrading Python distributions that are in-use by virtual environments.

  12. angelo-peronio commented on Feb 10, 2025

    @angelo-peronio

    Possibly a duplicate of #7892

  13. added a commit that references this issue on Jun 20, 2025
    e9d5780
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliRelated to the command line interface

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions