-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
project: vendored dependencyRelated to a vendored dependencyRelated to a vendored dependencytype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior
Description
pip version
21.0.1
Python version
3.6.8
OS
Windows 10
Additional information
$ python -VV
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
Description
When using multiple ~=
version specifiers that are compatible, pip fails with an error.
Expected behavior
pip should install one of the versions that satisfy both requirements.
How to Reproduce
- Make sure you have the latest numpy
$ pip freeze | grep numpy
numpy==1.19.5
- Install two overlapping version ranges that would require a downgrade:
pip install numpy~=1.18 numpy~=1.18.0
Output
$ pip install numpy~=1.18 numpy~=1.18.0
Looking in indexes: https://nexus-pypi-ci:****@nexus.devops.definiens.com/repository/pypi-all/simple
Requirement already satisfied: numpy~=1.18 in c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages (1.19.5)
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\cli\base_command.py", line 189, in _main
status = self.run(options, args)
File "c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\cli\req_command.py", line 178, in wrapper
return func(self, options, args)
File "c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\install.py", line 317, in run
reqs, check_supported_wheels=not options.target_dir
File "c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 122, in resolve
requirements, max_rounds=try_to_avoid_resolution_too_deep,
File "c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 453, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 347, in resolve
failure_causes = self._attempt_to_pin_criterion(name, criterion)
File "c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 221, in _attempt_to_pin_criterion
raise InconsistentCandidate(candidate, criterion)
pip._vendor.resolvelib.resolvers.InconsistentCandidate: Provided candidate AlreadyInstalledCandidate(numpy 1.19.5 (c:\users\kftf964\appdata\local\programs\python\python36\lib\site-packages)) does not satisfy SpecifierRequirement('numpy~=1.18'), SpecifierRequirement('numpy~=1.18.0')
Code of Conduct
- I agree to follow the PSF Code of Conduct
We found this problem in a pretty complex internal dependency tree. It's reproducible with a simple numpy install though.
I'd be very happy about a fix! For now, we work around this by explicitly stating version ranges, e.g. >=4.1,<5
.
teije01, adriangonz and whme
Metadata
Metadata
Assignees
Labels
project: vendored dependencyRelated to a vendored dependencyRelated to a vendored dependencytype: bugA confirmed bug or unintended behaviorA confirmed bug or unintended behavior