Open bersbersbers opened 3 years ago
This may be a good test case for the related issue #4551.
That’s basically what the new resolver is good for, it catches and prevents the inconsistent state from ever happening. You would end up with an inconsistent state after upgrading, so it refuses to upgrade and keep your environment in a consistent state. Everything seems to work as designed, from what I can tell.
@uranusjr I am not sure I agree. I will verify, but my understanding is that
textract
(which only fails because the old version does not compile) without need to do so,six
and other packages, so I don't think the environment is consistent, This may be two issues coming together: unwanted downgrade plus installation failure. But I would not say everything is working as planned.
pip install
:$ pip check
textract 1.6.3 has requirement python-pptx==0.6.18, but you have python-pptx 0.6.5.
textract 1.6.3 has requirement six==1.12.0, but you have six 1.10.0.
textract 1.6.3 has requirement SpeechRecognition==3.8.1, but you have speechrecognition 3.6.3.
textract 1.6.3 has requirement xlrd==1.2.0, but you have xlrd 1.0.0.
extract-msg 0.23.1 has requirement tzlocal==1.5.1, but you have tzlocal 2.1.
A similar problem can be reproduced starting from a clean environment using
pip install --upgrade extract-msg textract
and with
pip install --upgrade textract extract-msg
I think what may be happening here is that pip
first considers extract-msg==0.28.1
and then finds no suitable version of textract
to work with this. And this may be a general problem for pip
: if package A==1.0
depends on B
, if package A==2.0
depends on B==1.0
, and if B
has 1.0
and 2.0
available, two (upgrade) solutions are possible: you can install A 1.0
and B 2.0
, or A 2.0
and B 1.0
. Which one to prefer?
As a human, I see from pipdeptree
that A
(textract
) depends on B
(extract-msg
) - so I would try the most current version of A
(textract
) first. It is likely that the user is interested in using that package (as it is not dependent on any other package), and it is possible that B
has been installed only to serve A
s dependencies. Maybe pip could start with the most recent version of the top packages first?
TLDR:
fails while trying to install very old packages although newer packages are available. The command above is obtained from installing just two packages and then trying to upgrade all installed packages.
Clean environment and update pip (I tried 20.2.3, 21.0.1, 21.1.dev0):
Initialize environment and verify it's consistent
gives (for all pip versions I tested):
Some time later, I try to upgrade my installation. I usually do this because pip is not yet able to consider installed packages:
which gives (again, for all versions)
Running this command with pip 20.2.3 works, although it's ends up with an incompatible state:
While running it with 21.0.1 and today's 21.1.dev0 gives this:
Given that the environment is in a consistent state with all dependencies fulfilled, I'd say a better behvaior for this upgrade command (than to downgrade to
textract==0.5.1
, which is the first error) would be to do nothing. (I do see how that may be difficult given that pip does not take installed packages into account.)