Skip to content

Pip fails to install some satisfiable requirements since extras optimization #12376

@notatallshaw

Description

@notatallshaw

Description

In Pip 23.3, an extras optimization was introduced to improve the speed of backtracking when dealing with extras. However, under specific circumstances, this optimization can lead to Pip failing to install valid requirements.

In PR kedro-org/kedro#3182 it linked to a Pip issue #12317 as a cause of resolution failure, but investigating I found:

  1. The issue started occurring in Pip 23.3, not Pip 23.1.
  2. After examining the relevant code sarugaku/resolvelib#134, it seemed it was not responsible for triggering this error and therefore the error the PR is working around is not issue #12317

To further investigate I tested various Pip branches, and I believe the problem arises when the following warning is encountered:

WARNING: <package> <version> does not provide the extra '<extra>'

I hypothesize that the optimization is being applied when no extra actually exists. This occurs because extras are optional, and Pip will simply emit a warning when an extra is not present.

Expected behavior

Optimization should not cause failure

pip version

pip 23.3.1

Python version

3.11

OS

Linux

How to Reproduce

  1. git clone https://github.com/kedro-org/kedro
  2. cd kedro
  3. python3.11 -m venv .venv
  4. source .venv/bin/activate
  5. python -m pip install pip --upgrade
  6. pip install --dry-run .[test]

Output

...
WARNING: import-linter 1.8.0 does not provide the extra 'toml'
ERROR: Cannot install dask[complete]==2021.12.0 and kedro[test]==0.18.14 because these package versions have conflicting dependencies.

The conflict is caused by:
    kedro[test] 0.18.14 depends on dask~=2021.10; extra == "test"
    dask[complete] 2021.12.0 depends on dask 2021.12.0 (from https://files.pythonhosted.org/packages/15/6d/99c63be3ea8a4a651d845addeea1f1b3bb8e5c6730bc26cfb6176631adf7/dask-2021.12.0-py3-none-any.whl (from https://pypi.org/simple/dask/) (requires-python:>=3.7))

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions