Skip to content
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

Incorrect wheel dependencies when optional packages are combined with platform markers #6350

Closed
anaoum opened this issue Sep 2, 2022 · 3 comments · Fixed by python-poetry/poetry-core#462
Labels
area/core Related to the poetry-core library kind/bug Something isn't working as expected

Comments

@anaoum
Copy link

anaoum commented Sep 2, 2022

Issue

The above pyproject.toml has two versions of torch as a dependency, one for platform==linux, and one for platform==darwin. Both are marked as optional=true, and appear in the "mle" and "all" extras groups. When I generate the wheel package, the following METADATA is produced:

Metadata-Version: 2.1
Name: platras
Version: 0.1.0
Summary: 
Author: anaoum
Requires-Python: >=3.8,<3.9
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Provides-Extra: all
Provides-Extra: mle
Requires-Dist: loguru (>=0.6.0,<0.7.0)
Requires-Dist: torch @ https://download.pytorch.org/whl/cpu/torch-1.12.1-cp38-none-macosx_10_9_x86_64.whl ; sys_platform == "darwin"
Requires-Dist: torch @ https://download.pytorch.org/whl/cu113/torch-1.12.1%2Bcu113-cp38-cp38-linux_x86_64.whl ; (sys_platform == "linux") and (extra == "mle" or extra == "all")

Note that the darwin version of the torch dependency does not also condition on (extra == "mle" or extra == "all")

This can be easily reproduced using the linked pyproject.toml above and running poetry build.

This issue causes problems in downstream projects that attempt to install the package with extras, as poetry will see two incompatible versions of the same dependency and fail.

@anaoum anaoum added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 2, 2022
@dimbleby
Copy link
Contributor

dimbleby commented Sep 2, 2022

I think the fix should be as straightforward as removing this line if you - or anyone else - care to put together an MR.

Writing a testcase will be harder than making the fix

@neersighted neersighted added area/core Related to the poetry-core library and removed status/triage This issue needs to be triaged labels Sep 2, 2022
@anaoum
Copy link
Author

anaoum commented Sep 2, 2022

Thanks for the direction @dimbleby. I have confirmed that this resolves the issue, and implemented the fix/unit test in python-poetry/poetry-core#462

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/core Related to the poetry-core library kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants