pixi fails when a dependency is declared as a url in the project.dependencies field of pyproject.toml
Checks
-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pixi, using
pixi --version.
Reproducible example
pyproject.toml:
[project]
version = "0.1.0"
name = "test"
requires-python = "== 3.12"
dependencies = [
"torch @ https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp312-cp312-linux_x86_64.whl#sha256=a393b506844035c0dac2f30ea8478c343b8e95a429f06f3b3cadfc7f53adb597",
]
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64"]
[tool.pixi.pypi-dependencies]
test = { path = ".", editable = true }
Issue description
Running pixi install fails with
Error: × failed to solve the pypi requirements of 'default' 'linux-64'
├─▶ failed to resolve pypi dependencies
╰─▶ Requirements contain conflicting URLs for package `torch`:
- https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp312-cp312-linux_x86_64.whl#sha256=a393b506844035c0dac2f30ea8478c343b8e95a429f06f3b3cadfc7f53adb597
- https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp312-cp312-linux_x86_64.whl#sha256=a393b506844035c0dac2f30ea8478c343b8e95a429f06f3b3cadfc7f53adb597
Expected behavior
It solves as when invoked with the url declared in [tool.pixi.pypi-dependencies], as in the following pyproject.toml:
[project]
version = "0.1.0"
name = "test"
requires-python = "== 3.12"
dependencies = [ ]
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64"]
[tool.pixi.pypi-dependencies]
test = { path = ".", editable = true }
torch = { url = "https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp312-cp312-linux_x86_64.whl#sha256=a393b506844035c0dac2f30ea8478c343b8e95a429f06f3b3cadfc7f53adb597" }
@tdejager does this issue ring any bells for you? I wasn't aware about this issue but I remember work on the urls.
No, not sure what is going on 🙂
The culprit is the named anchor, i.e., the #sha256=... part of the URL. The following pyproject.toml solves:
[project]
version = "0.1.0"
name = "test"
requires-python = "== 3.12"
dependencies = [
"torch @ https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp312-cp312-linux_x86_64.whl",
]
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
[tool.hatch.metadata]
allow-direct-references = true
[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64"]
[tool.pixi.pypi-dependencies]
test = { path = ".", editable = true }
Any named anchor in the URL will fail to solve.
(The sha256 named anchor is used to ensure the integrity of the downloaded wheel.)
Ok right, well let's investigate why that leads to such a strange error message 🙂 That seems buggy at least.