Skip to content

Extremely slow dependency resolution with circular graph of dependencies #12210

@multimeric

Description

@multimeric

Description

I have a scenario where I need to depend on 3 packages, one of which depends on the two others:

flowchart LR
    my_package --> aicsimageio
    my_package --> napari_aicsimageio
    my_package --> napari
    napari_aicsimageio --> napari
    napari_aicsimageio --> aicsimageio
Loading

When I try to install all these packages simultaneously, pip seems to struggle with the installation, but if I remove one of the nodes of the graph (thereby removing the cycle), it has no issue. Edit: actually I realise that this isn't a cycle, but I don't know how else to describe this graph pattern.

Expected behavior

In this case I expect to be able to solve the dependency tree. It may be the case that this tree of dependencies has no solution, but even if that is the case, I would hope that pip could realise it much faster than it does now.

pip version

23.2.1

Python version

3.9.12

OS

MacOS Monterey (12.6)

How to Reproduce

To obtain the infinite or very slow package solving, run this: pip install 'aicsimageio==4.9.1' 'napari-aicsimageio==0.7.2' 'napari==0.4.18'.

Note that, if you instead install two of the above three packages, pip has barely any trouble, and installs in a minute or so.

Output

The full log is extremely long, but I get lots of lines like the following:

INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
INFO: pip is still looking at multiple versions of scikit-image[data] to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of imageio[ffmpeg] to determine which version is compatible with other requirements. This could take a while.

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    S: needs triageIssues/PRs that need to be triagedtype: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions