-
Notifications
You must be signed in to change notification settings - Fork 1
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
Backtracking Resolver misses a category of conflict resolutions. #12
Comments
I have a new algorithm (adapted from this one), but this will have to wait until after I've worked on testing rbtcollins' pip backtracker patch. |
There's a workaround that mitigates this problem in some cases (but does not eliminate it). Here's a particular experiment: Conclusion: Bigjob(0.64.5) has resolvable dependencies, and Issue 12 caused the resolution to fail, but sorting dependencies both ways allows the resolver to succeed in this case. Backtracker couldn't find solution to bigjob(0.64.5)
Sorted bigjob's immediate dependencies alphabetically:
Repeated, to the same result. Sorted bigjob's immediate dependencies reverse-alphabetically:
Repeated backtracking resolution, with success:
|
There are two ways this can fail (aside from the dependencies simply being unresolvable):
If I have two dependency libraries, one alpha and one reverse-alpha, and use alpha for one solution run and reverse-alpha for another, that will handle a lot of the missed resolutions (though not those which require alpha order and reverse in the same run - I could do that, too, but this is already complicated enough as a workaround for something that I should just fix by rewriting the code with the new algorithm). Anyway, I think this has a better time complexity than the rewrite will. |
…fferent ways to improve resolution rate (though still doesn’t fix underlying bug, which requires rewrite to the new algorithm, this should very substantially help). This involves three sorted versions of the elaborated dependencies, and up to three runs of the resolver. minor: made some arguments optional to solver functions (e.g. where edeps is not provided, will use depdata.elaborated_dependencies, etc) trivial: variable renames _FILENAME TO _FNAME
Updated stats: (Most of the 17% errors had been previously resolved by small bugfixes.) |
There's a bug relating to the innate order of the recursion in the backtracking resolver. While it resolves most conflicts, it misses a sizeable portion. gerritbot(0.2.0) exemplifies the error.
A dependency of gerritbot adds pbr 0.9.0 to be installed before gerritbot asserts its own dependency on pbr >=0.5 <0.6.
resolver.ConflictingVersionError is raised.
A simplified case:
X(1) depends on B and C, any version
B(1) has no dependencies
B(2) has no dependencies
C(1) depends on B==1
Once possible versions of B and all its dependencies are handled, the selected version of B (B(2) in this case) is set in stone and cannot be backtracked, so no version of C can be installed in this case.
While the algo does manage to resolve a surprising number of conflicts (58% of the 2,862 conflicts that pip fails to correctly resolve from a >200k package scrape of PyPI), this is obviously a substantial bug. Until it's fixed, I won't know how many more of the conflicts are resolvable (17% turn out to be malformed, but the other 35%, which show up as unresolvable, may or may not be.).
The algorithm has to be changed:
Rewrite the core of the backtracker (the high level part - not so long) either using Justin's algorithm (which may have the same bug) or, more likely, this one from semver-resolver.
This will allow it to catch all resolvable conflicts, and therefore categorize resolvable/unresolvable conflicts with certainty.
The text was updated successfully, but these errors were encountered: