Skip to content
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 sync: Distribution markupsafe==3.0.2 @ 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 #9647

Open
jfaust opened this issue Dec 4, 2024 · 7 comments
Assignees
Labels
bug Something isn't working needs-design Needs discussion, investigation, or design resolver Related to the package resolver

Comments

@jfaust
Copy link

jfaust commented Dec 4, 2024

Similar to #8922, but with uv sync. With the following pyproject.toml:

[project]
name = "uv-repro"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = ["jinja2==3.1.4"]

[tool.uv]
index-strategy = 'unsafe-best-match'
find-links = ['https://download.pytorch.org/whl/torch_stable.html']
extra-index-url = [
    'https://download.pytorch.org/whl/cpu',
]

I get:

Resolved 3 packages in 311ms
error: Distribution `markupsafe==3.0.2 @ 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 I add https://pypi.org/simple to the beginning of the extra-index-url list, the problem goes away.

@zanieb
Copy link
Member

zanieb commented Dec 4, 2024

To confirm, I can reproduce this

❯ uv lock
Resolved 3 packages in 952ms
Removed anyio v4.6.2.post1
Removed certifi v2024.8.30
Removed example v0.1.0
Removed h11 v0.14.0
Removed httpcore v1.0.7
Removed httpx v0.28.0
Removed idna v3.10
Added jinja2 v3.1.4
Added markupsafe v3.0.2
Removed sniffio v1.3.1
Added uv-repro v0.1.0
❯ uv sync
Resolved 3 packages in 407ms
error: Distribution `markupsafe==3.0.2 @ 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

The lock entry is

[[package]]
name = "markupsafe"
version = "3.0.2"
source = { registry = "https://download.pytorch.org/whl/cpu" }
wheels = [
    { url = "https://download.pytorch.org/whl/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396" },
]

@zanieb zanieb added the resolver Related to the package resolver label Dec 4, 2024
@zanieb
Copy link
Member

zanieb commented Dec 4, 2024

@charliermarsh looks like the universal resolver to account for wheels on additional indexes?

@zanieb zanieb added the bug Something isn't working label Dec 4, 2024
@zanieb
Copy link
Member

zanieb commented Dec 4, 2024

@jfaust I think the recommendation here would be to use the new index APIs and be explicit about where you want your packages to come from.

https://docs.astral.sh/uv/guides/integration/pytorch/
https://docs.astral.sh/uv/configuration/indexes/

@zanieb zanieb added the needs-design Needs discussion, investigation, or design label Dec 4, 2024
@jfaust
Copy link
Author

jfaust commented Dec 4, 2024

@zanieb Got it, that's much nicer. I'm brand new to uv so was just naively trying to convert a requirements.txt. In the repro it works great, I'll need to check a more involved example.

Should I close this, or would you still expect the original to have worked?

@zanieb
Copy link
Member

zanieb commented Dec 4, 2024

We should at least have a better error message for the original.

@charliermarsh
Copy link
Member

I'm starting to think about this problem.

@joellidin
Copy link

joellidin commented Jan 10, 2025

Hello, I am also having a similar problem. When following the guide on how to use uv with pytorch, I get the following error when trying to upgrade my dependencies with uv sync -U:

error: Distribution `torch==2.5.1 @ 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

I am pretty sure this worked before so I don't really know what have changed. I have also tried to set a marker specifically for linux but still get the issue.

[tool.uv.sources]
torch = [
  { index = "pytorch-cpu", marker = "platform_system == 'Linux'" },
]
torchvision = [
  { index = "pytorch-cpu", marker = "platform_system == 'Linux'" },
]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-design Needs discussion, investigation, or design resolver Related to the package resolver
Projects
None yet
Development

No branches or pull requests

4 participants