-
Notifications
You must be signed in to change notification settings - Fork 2.9k
uv sync and uv run --no-project end up in different version with same requirements #9514
Copy link
Copy link
Closed
Labels
questionAsking for clarification or supportAsking for clarification or support
Description
Hello
I had an issue with torch dependency. I am pretty sure the problem comes from torch and I opened an issue on that matter: pytorch/pytorch#141781
However, while investigating my issue I encountered a uv behaviour I do not fully understand.
The issue can be reproduced with the following very simple pyproject.toml:
[project]
name = "uv-torch-test"
version = "0.1.0"
requires-python = ">=3.8"
dependencies = [
"torch",
]
If you uv sync with Python 3.8 (either using .python-version or --python 3.8 option), it fails with the following error
error: Distribution `torch==2.5.1 @ registry+https://pypi.org/simple` can't be installed because it doesn't have a source distribution or wheel for the current platform
I think this is expected given the issue described here: pytorch/pytorch#141781.
However, the following command succeeds and indicates that uv ends up installing torch 2.4.1 in this case
uv run --no-project --python 3.8 --with "torch" python -c "import torch; print(torch.__version__)"
In conclusion:
-
One feature request:
- Having an option to print the package versions in
uv run --no-projectthe same way they are printed inuv syncwould have helped me a lot. The only solution to print them today is to use the--verboseoption which is extremely verbose. I use a lot the "uv run --no-project" command in my unit testing CI jobs, and adding the--verbosewould make the test results and logs difficult to read, whereas I just need the package versions.
- Having an option to print the package versions in
-
Two questions:
- Why does
uv run --no-project --python 3.8 --with "torch"dependency resolution ends up choosing2.4.1and not2.5.1when2.5.1is identified as compatible with Python 3.8 byuv sync? - Would Introduce a
--multi-versionpreference mode #8686 help avoid this behaviour? (really waiting for this one, it would help on several issues I encountered 😉 )
- Why does
Thank you 🙏
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionAsking for clarification or supportAsking for clarification or support