Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't install torch_scatter wheel from index on OSX #9646

Closed
dionhaefner opened this issue Dec 4, 2024 · 7 comments
Closed

Can't install torch_scatter wheel from index on OSX #9646

dionhaefner opened this issue Dec 4, 2024 · 7 comments
Assignees
Labels
bug Something isn't working question Asking for clarification or support

Comments

@dionhaefner
Copy link

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.

@charliermarsh
Copy link
Member

I think you need to do: "torch_scatter===2.1.2" instead of "torch_scatter".

@charliermarsh charliermarsh added the question Asking for clarification or support label Dec 6, 2024
@dionhaefner
Copy link
Author

dionhaefner commented Dec 6, 2024

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.

@charliermarsh
Copy link
Member

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.

@zanieb
Copy link
Member

zanieb commented Dec 17, 2024

(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)

@charliermarsh
Copy link
Member

@zanieb - this would also be fixed by my “incomplete wheels” PR…

@charliermarsh
Copy link
Member

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

@charliermarsh
Copy link
Member

Fixed by #10046.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working question Asking for clarification or support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants