-
Notifications
You must be signed in to change notification settings - Fork 1.5k
PyTorch nightly index makes uv download all torch versions in a loop #9651
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
Comments
We're backtracking on the package because its dependencies can't be solved. Because of the limitations of the torch index, we can't inspect its metadata without downloading the full wheel. With some verbose logs..
There are [project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12.0"
dependencies = [
"torch>=2.5.1", "pytorch-triton",
]
[tool.uv.sources]
torch = [
{ index = "pytorch-cpu"},
]
torchvision = [
{ index = "pytorch-cpu"},
]
pytorch-triton = [
{ index = "pytorch-cpu"},
]
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/nightly/cpu"
explicit = true |
A big part of the problem here (I assume) is that the PyTorch registry has no fast-path for metadata. So you literally have to download every version (in full) to understand the dependencies at each stage. |
@zanieb Thanks for the suggestion! I tried that, but it fails on macOS with the following error:
Removing |
I removed the != Darwin markers to debug, you should restore those (and include it for triton). |
That worked, thanks! Although, why did it work? As far as I understand, we are specifying to use the nightly index ONLY IF |
During lock, we'll solve for Darwin / not Darwin so there will be two versions
And yeah, the Darwin version will come from PyPI instead of the Pytorch CPU index (which only supports Linux). During sync, we install a locked version appropriate for the platform.
|
You can remove the extraneous |
Interesting. I was following Apple's guide on installing PyTorch nightly (https://developer.apple.com/metal/pytorch/) and they specify the following command:
If I run this using
This definitely looks like nightly, so it surely should exist on the Pytorch CPU index? I was able to reproduce using the following: dependencies = [
"torch",
"torchaudio",
"torchvision",
]
[tool.uv]
environments = [
"platform_system == 'Darwin'",
]
[tool.uv.sources]
torch = { url = "https://download.pytorch.org/whl/nightly/cpu/torch-2.6.0.dev20241126-cp312-none-macosx_11_0_arm64.whl" }
torchaudio = { url = "https://download.pytorch.org/whl/nightly/cpu/torchaudio-2.5.0.dev20241126-cp312-cp312-macosx_11_0_arm64.whl" }
torchvision = { url = "https://download.pytorch.org/whl/nightly/cpu/torchvision-0.20.0.dev20241126-cp312-cp312-macosx_11_0_arm64.whl" } I'm honestly not sure what the
Specifying a dependency Does this error throw because I am hardcoding macOS sources, while uv is trying to solve for all OSes so their dependencies can be included in the lock file? |
means "only lock for Darwin". https://docs.astral.sh/uv/concepts/projects/config/#limited-resolution-environments With I believe the |
Okay trial and error, the proper invocation is [project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12.0"
dependencies = [
"torch===2.6.0.dev20241204; platform_system == 'Darwin'",
"torchvision===0.20.0.dev20241205; platform_system == 'Darwin'",
"torch==2.6.0.dev20241204+cpu; platform_system != 'Darwin'",
"torchvision==0.20.0.dev20241205+cpu; platform_system != 'Darwin'",
"pytorch-triton; platform_system != 'Darwin'",
]
[tool.uv.sources]
torch = [
{ index = "pytorch-cpu" },
]
torchvision = [
{ index = "pytorch-cpu" },
]
pytorch-triton = [
{ index = "pytorch-cpu" },
]
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/nightly"
explicit = true Sorry it's such a pain, the torch indexes are very inconsistent in their versioning and distribution availability per platform. |
Got it, makes sense. Thanks for the help! |
This should be way better in the next release. |
I copied the full PyTorch example from https://docs.astral.sh/uv/guides/integration/pytorch/#using-a-pytorch-index:
Only difference is I swapped the index url to
https://download.pytorch.org/whl/nightly/cpu
When I run
uv sync
, it downloads all versions of torch in reverse order. It doesn't really stop until I Ctrl + C it. Without nightly, it works fine.The text was updated successfully, but these errors were encountered: