Skip to content
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

Incompatible versions when using ~= with truncated versions #10644

Closed
1 task done
adriangonz opened this issue Nov 8, 2021 · 1 comment
Closed
1 task done

Incompatible versions when using ~= with truncated versions #10644

adriangonz opened this issue Nov 8, 2021 · 1 comment
Labels
resolution: duplicate Duplicate of an existing issue/PR

Comments

@adriangonz
Copy link

Description

It seems that the latest version of pip has some issues resolving packages which have multiple "compatible release" (i.e. ~=) version specifications, particularly if some of them are truncated. For example, six ~= 1.15 and six ~= 1.15.0 (e.g. pip install six~=1.15 six~=1.15.0).

The result is that pip will fail with an InconsistentCandidate exception (see full output below).

This seems to have been introduced with, at least, pip == 21.3.1. We're not able to reproduce it with pip == 21.2.4.

Expected behavior

Following the example above, each of those requirements should be equivalent to:

  • six ~= 1.15, equivalent to six >= 1.15, == 1.*
  • six ~= 1.15.0, equivalent to six >= 1.15.0, == 1.15.*

Therefore, pip should be able to identify any six == 1.15.x release as compatible.

pip version

21.3.1

Python version

3.7.12

OS

Linux

How to Reproduce

  1. Try to install pip install six~=1.15 six~=1.15.0.
  2. Pip will fail with an InconsistentCandidate exception.

Output

$ pip install six~=1.15 six~=1.15.0

Collecting six~=1.15
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
ERROR: Exception:
Traceback (most recent call last):
  File "/home/agm/.virtualenvs/test/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
    status = run_func(*args)
  File "/home/agm/.virtualenvs/test/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/home/agm/.virtualenvs/test/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 339, in run
    reqs, check_supported_wheels=not options.target_dir
  File "/home/agm/.virtualenvs/test/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 93, in resolve
    collected.requirements, max_rounds=try_to_avoid_resolution_too_deep
  File "/home/agm/.virtualenvs/test/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 482, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/agm/.virtualenvs/test/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 374, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
  File "/home/agm/.virtualenvs/test/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 228, in _attempt_to_pin_criterion
    raise InconsistentCandidate(candidate, criterion)
pip._vendor.resolvelib.resolvers.InconsistentCandidate: Provided candidate LinkCandidate('https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl#sha256=8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 (from https://pypi.org/simple/six/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*)') does not satisfy SpecifierRequirement('six~=1.15'), SpecifierRequirement('six~=1.15.0')

Code of Conduct

@adriangonz adriangonz added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Nov 8, 2021
@adriangonz
Copy link
Author

Closing as it seems a duplicate of #9613

@DiddiLeija DiddiLeija added resolution: duplicate Duplicate of an existing issue/PR and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Nov 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: duplicate Duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

2 participants