Skip to content

extra-build-dependencies don't respect [tool.uv.sources] index pinning #18059

@XXXXRT666

Description

@XXXXRT666

Question

The documentation only mentions extra-build-dependencies and extra-build-variables. However, when I attempted to use them with uv pip, the installation failed with the following error:

uv pip install ".[cu128]"
uv pip install ".[flash-attn]"
Because there is no version of torch==2.10.0+cu128 and you require torch==2.10.0+cu128, we can conclude that your requirements are unsatisfiable.

When I uncomment the no-build-isolation-package, it works well

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "Package"
version = "0.0"

requires-python = ">=3.10,<3.14"
dependencies = [
  "pre-commit",
  "pip",
  "ninja",
  "cmake",
  "cython",
  "setuptools",
  "wheel",
  "build",
]

[project.optional-dependencies]
flash-attn = [
  "flash-attn; sys_platform != 'darwin'",
  "psutil",
  "packaging",
  ]
cu126 = [
  "torch>2.6",
  "torchcodec",
]
cu128 = [
  "torch>2.6",
  "torchcodec",
]


[tool.hatch.build.targets.wheel]
  bypass-selection = true

[tool.uv]
upgrade = true
# no-build-isolation-package = ["flash-attn"]
conflicts = [
  [
    { extra = "cu126" },
    { extra = "cu128" },
  ],
]

[tool.uv.extra-build-dependencies]
flash-attn = [{ requirement = "torch", match-runtime = true }]

[tool.uv.extra-build-variables]
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }


[tool.uv.sources]
torch = [
  { index = "pytorch-cu126", extra = "cu126" },
  { index = "pytorch-cu128", extra = "cu128" },
]
flash-attn = [
  { index = "XXXXRT" },
]
torchao = [
  { index = "pytorch-cpu" },
]
torchcodec = [
  { index = "pytorch-cu126", extra = "cu126" },
  { index = "pytorch-cu128", extra = "cu128" },
]


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

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

[[tool.uv.index]]
name = "XXXXRT"
url = "https://xxxxrt666.github.io/PIP-Index"
explicit = true

Platform

Ubuntu 22.04 AArch64

Version

uv 0.10.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions