Skip to content

pip install A~=x.y A~=x.y.0 fails if A==x.z.0 (z>y) exists #11086

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

Closed
idanmiara opened this issue May 3, 2022 · 2 comments
Closed

pip install A~=x.y A~=x.y.0 fails if A==x.z.0 (z>y) exists #11086

idanmiara opened this issue May 3, 2022 · 2 comments
Labels
type: bug A confirmed bug or unintended behavior

Comments

@idanmiara
Copy link

Description

Say there is a pip package A with versions 1.20.0, 1.20.1, 1.22.5 why would the following code fails? (example with boto3 but not specific to that pacakge)

pip install boto3~=1.20 boto3~=1.20.0

pip tries to install 1.22.5 which doesn't satisfy both conditions.
Whereas 1.20.1 does satisfy both conditions, and the following does install successfully:

pip install boto3~=1.20 boto3~=1.20.0 boto3==1.20.1

This bug comes into effect when I have code that depends on packages X, Y:
package X that depends on boto3~=1.20
package Y that depends on boto3~=1.20.0
And I couldn't find a way to install X and Y.

Expected behavior

pip install boto3~=1.20 boto3~=1.20.0 would install the latest boto3~=1.20.*

pip version

22.0.4

Python version

3.9.7

OS

MacOS

How to Reproduce

pyenv install 3.9.7
pyenv virtualenv 3.9.7 test_3.9.7
pyenv local test_3.9.7
pip install --upgrade pip
pip install boto3~=1.20 boto3~=1.20.0

Output

Collecting boto3~=1.20
  Using cached boto3-1.22.5-py3-none-any.whl (132 kB)
Collecting jmespath<2.0.0,>=0.7.1
  Using cached jmespath-1.0.0-py3-none-any.whl (23 kB)
Collecting botocore<1.26.0,>=1.25.5
  Using cached botocore-1.25.5-py3-none-any.whl (8.7 MB)
Collecting s3transfer<0.6.0,>=0.5.0
  Using cached s3transfer-0.5.2-py3-none-any.whl (79 kB)
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/idan.miara/.pyenv/versions/3.9.7/envs/test_3.9.7/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "/Users/idan.miara/.pyenv/versions/3.9.7/envs/test_3.9.7/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/Users/idan.miara/.pyenv/versions/3.9.7/envs/test_3.9.7/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 339, in run
    requirement_set = resolver.resolve(
  File "/Users/idan.miara/.pyenv/versions/3.9.7/envs/test_3.9.7/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 94, in resolve
    result = self._result = resolver.resolve(
  File "/Users/idan.miara/.pyenv/versions/3.9.7/envs/test_3.9.7/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/idan.miara/.pyenv/versions/3.9.7/envs/test_3.9.7/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 373, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
  File "/Users/idan.miara/.pyenv/versions/3.9.7/envs/test_3.9.7/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 227, in _attempt_to_pin_criterion
    raise InconsistentCandidate(candidate, criterion)
pip._vendor.resolvelib.resolvers.InconsistentCandidate: Provided candidate LinkCandidate('https://files.pythonhosted.org/packages/dd/19/6f4569fc387acb868a60fdc22632a6ee038533f416babd3eff7a8f52edeb/boto3-1.22.5-py3-none-any.whl#sha256=e6b4a4970cb9210d455f348577d9e0485f86c44baf278b8220e8ab5587d03470 (from https://pypi.org/simple/boto3/) (requires-python:>= 3.6)') does not satisfy SpecifierRequirement('boto3~=1.20'), SpecifierRequirement('boto3~=1.20.0')


### Code of Conduct

- [X] I agree to follow the [PSF Code of Conduct](https://www.python.org/psf/conduct/).
@idanmiara idanmiara added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels May 3, 2022
@uranusjr
Copy link
Member

uranusjr commented May 3, 2022

Duplicate of #9613

@uranusjr uranusjr marked this as a duplicate of #9613 May 3, 2022
@uranusjr uranusjr closed this as completed May 3, 2022
@idanmiara
Copy link
Author

Thanks @uranusjr I appreciate your prompt response!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2022
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants