-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Summary
When removing a package after installing Pytorch using the official tutorial gives an error: Extras `cpu` and `cu124` are incompatible with the declared conflicts: {`test[cpu]`, `test[cu124]`}
- Step to reproduce
-
uv init test -p 3.10 -
Use this config for pyproject.toml
[project]
name = "test"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []
[project.optional-dependencies]
cpu = ["torch==2.6.0", "torchvision==0.21.0", "torchaudio==2.6.0"]
cu124 = ["torch==2.6.0", "torchvision==0.21.0", "torchaudio==2.6.0"]
[tool.uv]
conflicts = [[{ extra = "cpu" }, { extra = "cu124" }]]
[tool.uv.sources]
torch = [
{ index = "pytorch-cpu", extra = "cpu" },
{ index = "pytorch-cu124", extra = "cu124" },
]
torchvision = [
{ index = "pytorch-cpu", extra = "cpu" },
{ index = "pytorch-cu124", extra = "cu124" },
]
torchaudio = [
{ index = "pytorch-cpu", extra = "cpu" },
{ index = "pytorch-cu124", extra = "cu124" },
]
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
[[tool.uv.index]]
name = "pytorch-cu124"
url = "https://download.pytorch.org/whl/cu124"
explicit = true
-
uv sync --extra cu124 -
uv add tensorboard -
uv remove tensorboard
This return the error error: Extras `cpu` and `cu124` are incompatible with the declared conflicts: {`test[cpu]`, `test[cu124]`}
Even though the package tensorboard is remove from the pyproject.toml file, it's not actually remove and can still be seen with uv pip list
Package Version
------------------------ ------------
absl-py 2.2.2
filelock 3.18.0
fsspec 2025.3.2
grpcio 1.71.0
jinja2 3.1.6
markdown 3.7
markupsafe 3.0.2
mpmath 1.3.0
networkx 3.4.2
numpy 2.2.4
nvidia-cublas-cu12 12.4.5.8
nvidia-cuda-cupti-cu12 12.4.127
nvidia-cuda-nvrtc-cu12 12.4.127
nvidia-cuda-runtime-cu12 12.4.127
nvidia-cudnn-cu12 9.1.0.70
nvidia-cufft-cu12 11.2.1.3
nvidia-curand-cu12 10.3.5.147
nvidia-cusolver-cu12 11.6.1.9
nvidia-cusparse-cu12 12.3.1.170
nvidia-cusparselt-cu12 0.6.2
nvidia-nccl-cu12 2.21.5
nvidia-nvjitlink-cu12 12.4.127
nvidia-nvtx-cu12 12.4.127
packaging 24.2
pillow 11.1.0
protobuf 6.30.2
setuptools 78.1.0
six 1.17.0
sympy 1.13.1
tensorboard 2.19.0
tensorboard-data-server 0.7.2
torch 2.6.0+cu124
torchaudio 2.6.0+cu124
torchvision 0.21.0+cu124
triton 3.2.0
typing-extensions 4.13.1
werkzeug 3.1.3
The package is also still in the venv folder as when you run which tensorboard it return "test/.venv/bin/tensorboard"
The only way to actually remove it is to run uv sync since it will sync the environment with the pyproject.toml and since the package is remove in there, running uv sync --extra cu124 will actually remove it now
Resolved 35 packages in 0.51ms
Uninstalled 10 packages in 10ms
- absl-py==2.2.2
- grpcio==1.71.0
- markdown==3.7
- packaging==24.2
- protobuf==6.30.2
- setuptools==78.1.0
- six==1.17.0
- tensorboard==2.19.0
- tensorboard-data-server==0.7.2
- werkzeug==3.1.3
Is there any way to prevent this error as there should obviously no error when you remove this package, and I don't have to use uv sync to actually remove the package
Platform
Linux 6.8.0-57-generic x86_64 GNU/Linux
Version
uv 0.7.2
Python version
Python 3.10.15