-
Notifications
You must be signed in to change notification settings - Fork 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
Unexpected conflict resolution for flake / flake8-isort #10568
Comments
Putting |
Both combinations are valid. You say the older flake8-isort results in a version of flake8 that "is not compatible with the rest of the installed dependencies", but pip does not consider dependencies of already-installed packages in this situation - see #7744 for (extensive) discussion of this. The order in which packages is listed influences the search order the resolver uses. When multiple "correct" solutions exist, this may influence which one is found first (and hence used). |
pip doesn't install an older version of The output I posted in my report is an installation in an empty virtualenv. Nothing is installed yet. Here's the output again with some of the "noise" cut out:
If I'm following things correctly this happens:
The first bit of this seems reasonable to me. The thing that confuses me is the decision to look at older versions of flake8-isort, even though the most recent version already declared itself to not be compatible with flake8~=4.0. |
I imagine there's a conflict somewhere. I'd have to pull out the whole dependency tree to determine where. I don't have time to do that right now - I'll see if I can find some time later. However, the key point here is that what pip installed is a solution to the requirements you gave. It's not the only solution, but we don't make any commitment as to which solution we find, just that we find one. As far as I'm aware, there aren't any algorithms for solving dependency issues while also guaranteeing to get the "best" solution under some particular metric (apart from getting all solutions and then picking one, but that's really expensive). One thing you can do - if you know you want the latest version of flake8-isort, you can just specify that explicitly. |
It seems this will be fixed (hopefully shortly) in The issue was reported here: gforcada/flake8-isort#103 |
This is a common pitfall for us humans to wrap our heads around dependency resolution. The fact that the latest
In this case, for The bottom line is, where there are multiple possible solutions to a dependency specification, there's no way for pip to tell exact what solution is preferred, so you need to supply more hints to it. There are a few of ways to do that right now:
I'm going to close this for now since there isn't really a good way to "fix" this. There are maybe some potential hacks we could try (e.g. we can sort of "tell" flake8 is a dependency of flake8-isort from prefix, but even with that information it's unclear why we should prefer either), so it's probably to instead wait for a concrete proposal instead of having an issue open with action items available. |
Description
With a
requirements.txt
listing onlyflake8
andflake8-isort
pip will install a combination of packages that doesn't work.The most recent version of
flake8-isort
pinsflake8<4
, the most recent version offlake8
is ~4.0. Instead of installing an older version offlake8
, pip installs and older version offlake8-isort
that doesn't pinflake8
, but is not compatible with the rest of the installed dependencies.Expected behavior
I'd expect pip to honor the pin of
flake8-isort
instead of looking for an older version that has not yet pinned the list of dependencies.pip version
21.2.4
Python version
3.8.12
OS
macOS 10.15.7
How to Reproduce
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: