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

You're on Linux (manylinux_2_39_x86_64), but torch (v2.5.1) only has wheels for the following platform: linux_aarch64 #11418

Closed
sglbl opened this issue Feb 11, 2025 · 11 comments
Labels
needs-mre Needs more information for reproduction

Comments

@sglbl
Copy link

sglbl commented Feb 11, 2025

Summary

When I try to install requirements (that has pytorch with cuda) from pyproject.toml, I got this error.
Image

$ uv sync --extra gpu
error: Distribution `torch==2.5.1 @ registry+https://download.pytorch.org/whl/cu124` can't be installed 
because it doesn't have a source distribution or wheel for the current platform
hint: You're on Linux (`manylinux_2_39_x86_64`), 
but `torch` (v2.5.1) only has wheels for the following platform: `linux_aarch64`

No one on other machine has touched to this pyproject toml / uv.lock file. I solved the issue by removing uv.lock.
The problem is all the time I have this kind of problems with uv.lock, when I remove it it works.
But since I installed torch==2.5.1 before and uv added this as "torch>=2.5.1" , after removing uv.lock it insalls torch==2.6.0+cu124.

Other than this many_linux and linux uncompatibility bug, is there a way to add a specific version to pyproject.toml with uv (without editing toml file by hand)?

Platform

Linux Ubuntu 24.04

Version

uv 0.5.29

Python version

Python 3.10.12

@sglbl sglbl added the bug Something isn't working label Feb 11, 2025
@charliermarsh
Copy link
Member

You mean like uv add torch==2.6.0? Or uv add torch==2.6.0+cu124?

(Unfortunately I can't help further without a complete reproduction, like a pyproject.toml and a series of commands that reproduces the issue.)

@charliermarsh charliermarsh added needs-mre Needs more information for reproduction and removed bug Something isn't working labels Feb 11, 2025
@zanieb
Copy link
Member

zanieb commented Feb 11, 2025

Note the manylinux_2_39_x86_64 tag is x86_64 while the other is linux_aarch64 which is arm64 — that's the incompatibility.

@ldng
Copy link

ldng commented Feb 11, 2025

Same issue.

Archlinux | glibc-2.41+r6+gcf88351b685d-1 | linux-6.13.2.arch1-1 | Arch: X86_64

Minimal pyproject.toml to reproduce :

[project]
name = "aarch64-issue"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = "==3.10.*"
dependencies = [
    "torch",
]


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

[tool.uv.sources]
torch = [
  { index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
]

$ uv sync --verbose

DEBUG uv 0.5.30 (ddbc6e315 2025-02-10)
DEBUG Found project root: `/tmp/aarch64_issue`
DEBUG No workspace root found, using project root
DEBUG Acquired lock for `/tmp/aarch64_issue`
DEBUG Reading Python requests from version file at `/tmp/aarch64_issue/.python-version`
DEBUG Using Python request `3.10` from version file at `.python-version`
DEBUG Checking for Python environment at `.venv`
DEBUG Searching for Python 3.10 in managed installations or search path
DEBUG Searching for managed installations at `~/.local/share/uv/python`
DEBUG Skipping incompatible managed installation `cpython-3.14.0a4-linux-x86_64-gnu`
DEBUG Skipping incompatible managed installation `cpython-3.12.8-linux-x86_64-gnu`
DEBUG Skipping incompatible managed installation `cpython-3.11.11-linux-x86_64-gnu`
DEBUG Found managed installation `cpython-3.10.16-linux-x86_64-gnu`
DEBUG Found `cpython-3.10.16-linux-x86_64-gnu` at `~/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/bin/python3.10` (managed installations)
Using CPython 3.10.16
Creating virtual environment at: .venv
DEBUG Assessing Python executable as base candidate: ~/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/bin/python3.10
DEBUG Using base executable for virtual environment: ~/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/bin/python3.10
DEBUG Released lock at `/tmp/uv-6ac5999c7feb2517.lock`
DEBUG Using request timeout of 30s
DEBUG Found static `pyproject.toml` for: aarch64-issue @ file:///tmp/aarch64_issue
DEBUG No workspace root found, using project root
DEBUG Existing `uv.lock` satisfies workspace requirements
Resolved 10 packages in 0.34ms
error: Distribution `torch==2.0.1 @ registry+https://download.pytorch.org/whl/rocm6.2` can't be installed because it doesn't have a source distribution or wheel for the current platform

hint: You're on Linux (`manylinux_2_40_x86_64`), but `torch` (v2.0.1) only has wheels for the following platform: `manylinux2014_aarch64`

@charliermarsh
Copy link
Member

You need this:

[project]
name = "aarch64-issue"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = "==3.10.*"
dependencies = [
    "torch>=2.5.1",
    "pytorch-triton-rocm",
]


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

[tool.uv.sources]
torch = [
  { index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
]
pytorch-triton-rocm = [
  { index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
]

You're using an explicit index, but pytorch-triton-rocm doesn't exist on PyPI at the version you need, so the resolver is backtracking.

@charliermarsh
Copy link
Member

(I don't think your issue is related? OP is asking about the cu124 index.)

@sglbl
Copy link
Author

sglbl commented Feb 11, 2025

This is my toml file.

[project]
name = "ex"
version = "0.1.0"
description = "example Project"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "aiohttp>=3.11.11",
    "fastapi>=0.115.6",
    "gradio==5.6.0",
    "gradio-log>=0.0.8",
    "haystack-ai==2.4.0",
    "lingua-language-detector==2.0.2",
    "loguru>=0.7.3",
    "msal>=1.31.1",
    "munch>=4.0.0",
    "ollama-haystack==0.0.7",
    "openai>=1.59.4",
    "openpyxl>=3.1.5",
    "psycopg2>=2.9.10",
    "pypdf>=5.1.0",
    "pytest>=8.3.4",
    "python-dotenv>=1.0.1",
    "qdrant-haystack>=7.0.0",
    "ring>=0.10.1",
    "sentence-transformers>=3.3.1",
    "sqlalchemy==2.0.31",
    "sqlitedict>=2.1.0",
    "tabulate>=0.9.0",
    "tiktoken>=0.8.0",
    "transformers>=4.47.1",
    "unidecode>=1.3.8",
    "xlsxwriter>=3.2.1",
]


[dependency-groups]
dev = [
    "jupyter>=1.1.1",
    "pypdf2>=3.0.1",
]

[project.optional-dependencies]
cpu = [
  "torch==2.5.1",
]
gpu = [
  "torch==2.5.1",
]

[tool.uv]
conflicts = [ # type:ignore
  [
    { extra = "cpu" },
    { extra = "gpu" },
  ],
]

[tool.uv.sources]
torch = [
  { index = "pytorch-cpu", extra = "cpu", marker = "platform_system != 'Darwin'" },
  { index = "pytorch-gpu", extra = "gpu" },
]

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

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

[tool.pytest.ini_options]
pythonpath = "." # Add the project root path to the pythonpath [to be able to import the 'src' module]
filterwarnings = ["ignore::DeprecationWarning", "ignore::FutureWarning", "ignore::PendingDeprecationWarning"]

On the first install everything is fine (always). But when I add a new package and change from gpu to cpu version makes some changes on uv.lock file and then new installations create problem. So I need to remove uv.lock. (Unfortunately I don't remember the exact order of reproducing the issue or if it was because of an exact package(such as lingua..)) But both of my computers that I use for this project is has x86_64 so it shouldn't even have linux_aarch64:

~$ uname -m
x86_64

@charliermarsh My second question was: when I use uv add torch, it will install last version (for example 2.6.0+cu124) and add >=2.6.0+cu124 to toml. But if I remove the lock and some months later if I reinstall from my toml, it might install a uncompatible newer version which I don't want. So is there a way to add it to toml without specifying the version? (This question is not that important for me, just a side question)

@ldng
Copy link

ldng commented Feb 12, 2025

(I don't think your issue is related? OP is asking about the cu124 index.)

I'll take your word for it. Still, the "aarch64" hint is confusing in both cases.

@zanieb
Copy link
Member

zanieb commented Feb 12, 2025

@ldng The hint is just a fact about what wheels are available for that version...

Image

You're on x86-64, only aarch64 wheels are available for the version in the lockfile — those are incompatible architectures.

The fix is to adjust your dependencies so we do not lock a version that cannot be used on your current platform.

@zanieb
Copy link
Member

zanieb commented Feb 12, 2025

I'm happy to improve the hint though, do you have a suggestion that would clarify things for you?

@sglbl
Copy link
Author

sglbl commented Feb 15, 2025

@charliermarsh If you cannot reproduce, if you want I can close the issue until somebody else encounters this issue and opens it again

@charliermarsh
Copy link
Member

I think this could plausibly be improved by #11546 which I just merged. If you encounter it again and have a reproduction, I'm always happy to re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-mre Needs more information for reproduction
Projects
None yet
Development

No branches or pull requests

4 participants