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

Poetry add does not resolve the correct package version given the project constraints #6812

Closed
4 tasks done
snejus opened this issue Oct 15, 2022 · 3 comments
Closed
4 tasks done
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@snejus
Copy link
Contributor

snejus commented Oct 15, 2022

  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Currently, an attempt to add a dependency

  • without a version constraint and
  • which does not anymore support the lowest python version that the project supports

produces an error:

$ poetry add multimethod                                                                        
Using version ^1.9 for multimethod

Updating dependencies
Resolving dependencies... (0.0s)

The current project's Python requirement (>=3.6.3,<4) is not compatible with some of the required packages Python requirement:
  - multimethod requires Python >=3.7, so it will not be satisfied for Python >=3.6.3,<3.7

Because multimethod (1.9) requires Python >=3.7
 and no versions of multimethod match >1.9,<2.0, multimethod is forbidden.
So, because rich-tables depends on multimethod (^1.9), version solving failed.
...

In this case,

  • the project requires python = ">=3.6.3,<4"
  • the dependency requires python >= 3.7 (one of the recent releases)
  • the dependency used to support python3.6

Given that poetry add documentation says

If you do not specify a version constraint, poetry will choose a suitable one based on the available package versions.

I would expect poetry to check all previous dependency versions and use the one that fits my project constraints, if it exists. Instead, now it implicitly looks for a recent version: Using version ^1.9 for multimethod.

This can now be achieved by adding multimethod = "*" and running poetry update and I'd expect poetry add to match this behaviour when the dependency version is not specified.

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

duplicate #707, among others

@snejus
Copy link
Contributor Author

snejus commented Oct 16, 2022

I thought this must have been mentioned somewhere, but failed use the right search terms! Thanks

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
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants