-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 lock
locks incorrect torch cpu version on macOS
#9209
Labels
question
Asking for clarification or support
Comments
uv lock
locks incorrect torch version on macOS uv lock
locks incorrect torch cpu version on macOS
Unfortunately this is correct. Torch doesn't publish |
One option: [project]
name = "torch-uv"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"torch>=2.4, <2.5"
]
[tool.uv.sources]
torch = { index = "torch-cpu", marker = "sys_platform != 'darwin'" }
[[tool.uv.index]]
name = "torch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true |
Another: [project]
name = "torch-uv"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"torch==2.4.1+cpu ; sys_platform != 'darwin'",
"torch===2.4.1 ; sys_platform == 'darwin'"
]
[tool.uv.sources]
torch = { index = "torch-cpu" }
[[tool.uv.index]]
name = "torch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true |
A third: [project]
name = "torch-uv"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"torch==2.4.1",
"torch!=2.4.1+cpu ; sys_platform == 'darwin'"
]
[tool.uv.sources]
torch = { index = "torch-cpu" }
[[tool.uv.index]]
name = "torch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true |
thanks you very much ! solved |
No prob. I'm working on comprehensive docs for this now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am following a very simple workflow to test this situation :
uv init torch-uv
torch
,torchaudio
topyproject.toml
.venv
withuv venv
uv pip install .
. When i runuv pip show torch
i getVersion: 2.4.1
. I can successfullysource .venv/bin/activate
and runpython
, import torch etc.uv lock
. Here is the problem, in the lock file i haveuv run python
i error witherror: Distribution
torch==2.4.1+cpu @ registry+https://download.pytorch.org/whl/cpu` can't be installed because it doesn't have a source distribution or wheel for the current platform`If repeat the same process by having only "torchaudio>=2.4, <2.5" in my dependencies, torch will be downloaded but the lock file will be correct, without the
+cpu
. Am i missing something here ?The text was updated successfully, but these errors were encountered: