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

Dependency resolution conflicts with hyphen in extras #11649

Closed
1 task done
subbyte opened this issue Dec 9, 2022 · 2 comments · Fixed by #12002
Closed
1 task done

Dependency resolution conflicts with hyphen in extras #11649

subbyte opened this issue Dec 9, 2022 · 2 comments · Fixed by #12002
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@subbyte
Copy link

subbyte commented Dec 9, 2022

Description

In the last couple of days, when pip install kestrel-jupyter==1.0.6, it will fail with a pip internal issue:

AssertionError: Internal issue: Candidate is not for this requirement jsonschema[format-nongpl,format-nongpl] vs jsonschema[format-nongpl]

The package kestrel-jupyter has dependencies

  • jupyterlab-server (from jupyterlab)
  • stix2-validator (from stix-shifter from kestrel-lang)

I checked that stix2-validator requires jsonschema[format-nongpl].
And it looks like jupyterlab-server only requires jsonschema.

Usually this will not lead to anything wrong, but several people hit the same error when installing kestrel-jupyter. The generated requirement jsonschema[format-nongpl,format-nongpl] looks strange. When I check further with pip --debug, it looks like pip tries to satisfy jsonschema with extras format-nongpl and format_nongpl (hyphen and underscore). Not sure how this happened and whether this led to a dependency resolution failure.

Expected behavior

Success installation of kestrel-jupyter.

I find a version of jupyterlab-server that does not trigger the issue, so I released a new version of kestrel-jupyter (1.0.7) to specify that version of jupyterlab-server and temporarily mitigate the issue for users.

That is to say, this will work:

# in a clean Python venv with latest pip
pip install jupyterlab-server==2.15.2
pip install kestrel-jupyter==1.0.6

But the following will fail:

# in a clean Python venv with latest pip
# jupyterlab-server>=2.16 will be installed
pip install kestrel-jupyter==1.0.6

pip version

22.3.1

Python version

3.9

OS

macos

How to Reproduce

In a newly created Python venv, upgrade pip to the latest (22.3.1), then do:

pip install kestrel-jupyter==1.0.6

Output

ERROR: Exception:
Traceback (most recent call last):
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 400, in run
    requirement_set = resolver.resolve(
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
    result = self._result = resolver.resolve(
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 373, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 222, in _attempt_to_pin_criterion
    satisfied = all(
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 223, in <genexpr>
    self._p.is_satisfied_by(requirement=r, candidate=candidate)
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 233, in is_satisfied_by
    return requirement.is_satisfied_by(candidate)
  File "/Users/subx/venv/test3/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.py", line 84, in is_satisfied_by
    assert candidate.name == self.name, (
AssertionError: Internal issue: Candidate is not for this requirement jsonschema[format-nongpl,format-nongpl] vs jsonschema[format-nongpl]

Code of Conduct

@subbyte subbyte added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Dec 9, 2022
@pradyunsg
Copy link
Member

This looks like it's related to #11445.

Could you post the output of a pip install with --debug in a Gist and share that here?

@subbyte
Copy link
Author

subbyte commented Dec 11, 2022

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants