uv icon indicating copy to clipboard operation
uv copied to clipboard

Panic: Resolution should contain all packages

Open BradLucky opened this issue 10 months ago • 8 comments

We are using uv in Github Actions to install our dependencies. It has been running great for a few weeks now until this afternoon (after 0.1.27 released). Using https://github.com/marketplace/actions/setup-uv, we did not have uv locked to a specific version, and it was unable to install dependencies, giving the error.

Running the command uv pip install --system -r requirements.txt produces the error:

Resolved 202 packages in 605ms
thread 'main' panicked at crates/uv/src/commands/pip_install.rs:670:18:
Resolution should contain all packages
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After a bit of research, I tried locking CI to version 0.1.26 and things worked fine.

Resolved 202 packages in 6.16s
Downloaded 3 packages in 94ms
Installed 3 packages in 11ms

Our CI runner OS is Ubuntu 22.04.4 LTS.

BradLucky avatar Apr 01 '24 21:04 BradLucky

This sounds very likely to be a regression related to #2596

Can you share more details on the requirements? Do you have a minimal reproduction?

zanieb avatar Apr 01 '24 21:04 zanieb

Or even a maximal reproduction :)

charliermarsh avatar Apr 01 '24 22:04 charliermarsh

One reproduction is if you have multiple versions of a package installed. Then, the resolver will try to use them, but the install plan will reject them all.

uv venv --seed
source .venv/bin/activate
pip install anyio==3.7.0 --ignore-installed
pip install anyio==4.0.0 --ignore-installed
uv pip install anyio black --verbose

Yields:

thread 'main' panicked at crates/uv/src/commands/pip_install.rs:678:18:
Resolution should contain all packages
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

charliermarsh avatar Apr 01 '24 22:04 charliermarsh

In general, we probably need to try and reduce the coupling in the assumptions, hmm...

charliermarsh avatar Apr 01 '24 22:04 charliermarsh

I got the same error on my local machine when installing the following minimal requirements.txt file:

--extra-index-url https://private-package-registry/simple
--extra-index-url https://download.pytorch.org/whl/cpu

torch==2.1.0+cpu
private-package==1.0.0  # Does not depend on torch
uv pip install -r requirements.txt
Resolved 47 packages in 330ms
thread 'main' panicked at crates\uv\src\commands\pip_install.rs:670:18:
Resolution should contain all packages
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

bschoenmaeckers avatar Apr 02 '24 13:04 bschoenmaeckers

@bschoenmaeckers are any of those packages already installed locally?

zanieb avatar Apr 02 '24 14:04 zanieb

@bschoenmaeckers I cannot reproduce this:

❯ cat requirements.txt
--extra-index-url https://astral-sh.github.io/packse/0.3.8/simple-html/
--extra-index-url https://download.pytorch.org/whl/cpu

torch==2.1.0+cpu
example-a==1.0.0

❯ uv venv
Using Python 3.11.8 interpreter at: /usr/bin/python3
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate

❯ cargo run -- pip install -r requirements.txt
    Finished dev [unoptimized + debuginfo] target(s) in 0.16s
     Running `target/debug/uv pip install -r requirements.txt`
Resolved 11 packages in 558ms
Installed 11 packages in 860ms
 + example-a==1.0.0
 + example-b==2.0.0
 + filelock==3.9.0
 + fsspec==2023.4.0
 + jinja2==3.1.2
 + markupsafe==2.1.3
 + mpmath==1.3.0
 + networkx==3.2.1
 + sympy==1.12
 + torch==2.1.0+cpu
 + typing-extensions==4.8.0

zanieb avatar Apr 02 '24 16:04 zanieb

@bschoenmaeckers are any of those packages already installed locally?

I cannot reproduce this error anymore after creating a new venv. So it was maybe just a fluke.

bschoenmaeckers avatar Apr 02 '24 19:04 bschoenmaeckers

I'm going to close for now since we've fixed a few issues here. If you see it again in the latest release, please LMK and we'll re-open!

charliermarsh avatar Apr 07 '24 00:04 charliermarsh