-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Duplicate packages with conflicting extras #11133
Comments
I think the intended behavior here is that only If I look at the lock file, I see this for [[package]]
name = "torchmetrics"
version = "1.6.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "lightning-utilities" },
{ name = "numpy" },
{ name = "packaging" },
{ name = "torch", version = "2.2.1", source = { registry = "https://pypi.org/simple" } },
{ name = "torch", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "extra == 'extra-4-test-chgnet' or extra != 'extra-4-test-m3gnet'" },
] Notice that both dependencies = [
{ name = "torch", version = "2.2.1", source = { registry = "https://pypi.org/simple" }, marker = "extra == 'extra-4-test-m3gnet'" },
{ name = "torch", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "extra == 'extra-4-test-chgnet' or extra != 'extra-4-test-m3gnet'" },
] Which is correct. Those markers are disjoint. So I think this is a bug in resolution or possibly conflict marker simplification. This requires more investigation. |
Thanks for the quick response!
Yes, that was my expectation. This isn't directly related to the bug, but can I also ask a related question: is there a convenient way of specifying conflicting sets of extras? I know conflict groups are possible, but in this case, I'd like to be able to Is it currently necessary to specify each conflicting pair? |
Your sets of conflicts can be of arbitrary length. If I'm understanding you correctly, then I think you just want this: conflicts = [
[
{ extra = "chgnet" },
{ extra = "alignn" },
{ extra = "m3gnet" },
],
] And that will make all of them conflict with one another. |
Sorry, no I wasn't quite clear enough. For the above three, I would like to say that More generally, I would like one set of non-conflicting extras that are all able to use something like |
Yeah you have to explicitly specify the conflicts. Like this: conflicts = [
[
{ extra = "chgnet" },
{ extra = "alignn" },
],
[
{ extra = "chgnet" },
{ extra = "m3gnet" },
],
] |
Ok yep, thanks for clarifying! The number of pairs grows quite quickly as the two sets grow, but it's also quite a niche problem. |
Yeah if you want to open a new issue with a more complete view of what you're trying to do, and also what your full One thing to consider here is that every conflict you define leads to a fork in the resolver. So like, if you have a crazy number of conflicts, there is definitely a potential there for slower resolutions. |
Summary
We have three dependencies, which all require PyTorch:
mace-torch
, which requirestorch>=1.12
in their tagged releasechgnet
, which requirestorch>=2.4.1
in their tagged releasematgl
(labelledm3nget
), which requires anytorch
in their tagged release, but in most cases we need to requiretorch<=2.2.1
(and"dgl==2.1"
)A (relatively) minimal pyproject.toml for this, with the conflict between
chgnet
andm3gnet
specified:However, if I run
uv sync -p 312
with this, followed byuv pip list
, two versions oftorch
are installed:Strangely, we swap out
matgl
foralignn
(which only explicitly depends ontorch>=2.0.0
in their tagged release):then, when running
uv sync -p 312
, only torch 2.5.1 is installed.May be related to #10985.
Platform
macOS 15.2 arm64
Version
0.5.26
Python version
3.12.8
The text was updated successfully, but these errors were encountered: