uv: Using `uv tool run` to run an arbitrary version of a tool using a compatible version of Python doesn't work unless you explicitly specify the python version

Summary

I am attempting to find a proper uv invocation that will run an arbitrary version of a tool from an internal pypi package that does not share the same name as the package, without having to specify the specific Python version to use. I also want to make sure the command will work regardless of where I call it from (e.g. in a dir with a pyproject.toml, etc.).

So far, I have tried various iterations of this:

uv tool run --python-preference only-managed --index 'http://<internal pypi repo>:8080' --prerelease allow --from internal.namespace.package@latest tool --version

This does not work, but if I explicitly supply a compatible Python version with --python it does. It feels like since I am asking for a specific version of the package, and I am saying that I want uv to only use its managed versions of Python, it should be able to figure out the version that it needs.

Platform

macOS (Darwin 23.6.0 arm64)

Version

uv 0.6.1 (c91ee82a8 2025-02-17)

Python version

Python 3.13.0 (the tool uses 3.11)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 2
  • Comments: 17 (13 by maintainers)

Most upvoted comments

We might ignore the upper-bound – I’d have to check. Regardless, I feel like we should be able to do better here based on the wheel tag errors above.