Summary
(Essentially a continuation of #11133, but with an additional conflicting pair)
For a pyproject.toml:
[project]
name = "test"
version = "0.0.1"
requires-python = ">=3.10"
dependencies = [
"mace-torch==0.3.9",
]
[project.optional-dependencies]
chgnet = [
"chgnet == 0.4.0",
]
sevennet = [
"sevenn == 0.10.3",
]
all = [
"chgnet == 0.4.0",
"sevenn == 0.10.3",
]
# MLIPs with dgl dependency
alignn = [
"alignn == 2024.5.27",
"torch == 2.2",
"torchdata == 0.7.1",
]
m3gnet = [
"matgl == 1.1.3",
"torch == 2.2",
"torchdata == 0.7.1",
]
[tool.uv]
constraint-dependencies = [
"dgl==2.1",
"torch<2.6",
]
conflicts = [
[
{ extra = "chgnet" },
{ extra = "alignn" },
],
[
{ extra = "chgnet" },
{ extra = "m3gnet" },
],
[
{ extra = "all" },
{ extra = "alignn" },
],
[
{ extra = "all" },
{ extra = "m3gnet" },
],
]
Running uv sync -p 3.12 now correctly installs only torch==2.5.1.
However, running uv sync -p 3.12 --extra m3gnet installs both torch==2.2.0 and torch==2.5.1, in addition to two versions of sympy.
Similar to the previous example, it seems that in some cases, torch==2.5.1 seems to be set unconditionally, e.g. for e3nn (a dependency which is always required due to mace-torch, but also an optional dependency of sevenn):
[[package]]
name = "e3nn"
version = "0.4.4"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "opt-einsum-fx" },
{ name = "scipy" },
{ name = "sympy", version = "1.13.1", source = { registry = "https://pypi.org/simple" } },
{ name = "sympy", version = "1.13.3", source = { registry = "https://pypi.org/simple" }, marker = "extra == 'extra-4-test-alignn' or extra == 'extra-4-test-m3gnet'" },
{ name = "torch", version = "2.2.0", source = { registry = "https://pypi.org/simple" }, marker = "extra == 'extra-4-test-alignn' or extra == 'extra-4-test-m3gnet'" },
{ name = "torch", version = "2.5.1", source = { registry = "https://pypi.org/simple" } },
]
Platform
macOS 15.2 arm64
Version
uv 0.5.31 (e38ac49 2025-02-12)
Python version
Python 3.12.8
Summary
(Essentially a continuation of #11133, but with an additional conflicting pair)
For a pyproject.toml:
Running
uv sync -p 3.12now correctly installs onlytorch==2.5.1.However, running
uv sync -p 3.12 --extra m3gnetinstalls bothtorch==2.2.0andtorch==2.5.1, in addition to two versions ofsympy.Similar to the previous example, it seems that in some cases,
torch==2.5.1seems to be set unconditionally, e.g. fore3nn(a dependency which is always required due tomace-torch, but also an optional dependency ofsevenn):Platform
macOS 15.2 arm64
Version
uv 0.5.31 (e38ac49 2025-02-12)
Python version
Python 3.12.8