-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Dependency resolution takes hours for multiple python version markers #4670
Comments
I stumbled upon the same behavior. Poetry tries all combinations for multiple-constraints-dependencies, even if markers exclude each other, which means that the concerning combination is not relevant. I am not sure if it is expected behavior, but in my opinion, it definitely is a weakness. Sometimes this weakness leads not only to a longer runtime, but also to the fact that the dependencies cannot be resolved (see #3367 for example). (However, I must add to this that I do not know any dependency management tool for python that can handle multi-constraints-dependencies even as good as poetry.) Investigating #3367, I dived a little into the code. In general, changing the behavior of poetry in a way that only combinations whose intersection of markers is not empty are considered is not that difficult. However, there is at least one challenge that seems non-trivial (at least to me 😉 considering the current design of poetry): If only combinations whose intersection is not empty are considered, libraries that are only required for a specific marker (e.g. one python version) might be discarded erroneously. E.g., in the following example the constraint for lib2 for python 3.8 would be ignored if combinations with an empty intersection of markers were discarded.
|
I think, I found a solution for this issue. With the changes in PR #4695, I get the same lock file and the following output |
Just a me too comment. I've had |
Just letting know that this PR for pre-filtering markers also can help here. If we know the target system in advance, e.g. python = 3.9, we avoid getting into exponentially many combinations.
|
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. |
-vvv
option).Issue
My project requires to use multiple python versions. Some of the packages are not compatible for both of those python versions, for which I'm using multiple-constraints-dependencies as shown below. Without this, the
poetry lock --no-update -vvv
command took just 10 seconds. However, after adding this it takes forever to run the dependency resolution. Below is thepyproject.toml
file.I observed that the time for resolution keeps increasing as the number of constraints increase. I'm suspecting it builds and resolves multiple dependency trees, causing it to take so long. In the logs, I saw it performed 510 overrides:
0: Complete version solving took 256.095 seconds with 510 overrides
which seem to be permutations of above-mentioned constraints.Is this expected behavior?
The text was updated successfully, but these errors were encountered: