Can't install torch_scatter wheel from index on OSX
It seems impossible to install torch_scatter CPU wheels using uv on OSX. I'm following the official installation instructions which require --find-links to be passed.
pyproject.toml:
[project]
name = "foo"
requires-python = ">=3.10"
dependencies = [
"torch",
"torch_scatter",
]
version = "0.1.0"
[tool.uv.sources]
torch = [{ index = "pytorch-cpu", marker = "platform_system != 'Darwin'" }]
[tool.uv]
find-links = [
"https://data.pyg.org/whl/torch-2.5.1+cpu.html",
]
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
Results in this error:
$ uv venv
$ uv sync
⠙ Resolving dependencies...
warning: Missing version constraint (e.g., a lower bound) for `torch-scatter`
Resolved 13 packages in 2.52s
error: Distribution `torch-scatter==2.1.2+pt25cpu @ registry+https://data.pyg.org/whl/torch-2.5.1+cpu.html` can't be installed because it doesn't have a source distribution or wheel for the current platform
It seems that uv is picking up torch-scatter==2.1.2+pt25cpu instead of the (compatible) torch-scatter==2.1.2 wheel. pip-based installation works:
$ uv pip install torch_scatter -f https://data.pyg.org/whl/torch-2.5.1+cpu.html
# all good
I'm really looking for any pyproject.toml here that doesn't lead to uv sync choking on OSX.
I think you need to do: "torch_scatter===2.1.2" instead of "torch_scatter".
Same outcome:
error: Distribution `torch-scatter==2.1.2+pt25cpu @ registry+https://data.pyg.org/whl/torch-2.5.1+cpu.html` can't be installed because it doesn't have a source distribution or wheel for the current platform
It looks like uv is treating 2.1.2 and 2.1.2+pt25cpu as the same version and finds the latter first, which fails.
There are three equals signs in my version. 2.1.2+pt25cpu is a valid version if you request torch_scatter==2.1.2 -- that's how the spec works. If you want 2.1.2 but not 2.1.2+pt25cpu, you need torch_scatter===2.1.2.
(This is a consequence of PyTorch using the spec differently than it was intended, for details on the standards, see https://packaging.python.org/en/latest/specifications/version-specifiers/#local-version-identifiers)
@zanieb - this would also be fixed by my “incomplete wheels” PR…
After #9928, this would just be:
[project]
name = "foo"
requires-python = ">=3.10"
dependencies = [
"torch",
"torch_scatter",
]
version = "0.1.0"
[tool.uv.sources]
torch = [{ index = "pytorch-cpu" }]
[tool.uv]
find-links = [
"https://data.pyg.org/whl/torch-2.5.1+cpu.html",
]
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
Fixed by https://github.com/astral-sh/uv/pull/10046.