Skip to content

Exclude installed distributions with multiple versions from consideration in the resolver#2779

Merged
zanieb merged 3 commits intomainfrom
zb/fix-multiple-installed
Apr 2, 2024
Merged

Exclude installed distributions with multiple versions from consideration in the resolver#2779
zanieb merged 3 commits intomainfrom
zb/fix-multiple-installed

Conversation

@zanieb
Copy link
Copy Markdown
Member

@zanieb zanieb commented Apr 2, 2024

Addresses panic introduced in #2596 and reported in #2763 (comment)

When there are multiple versions of a package available, we remove the existing packages before installing the resolved version to "fix" the environment. We must remove all of the package versions and reinstall because removing any of the package versions could break the others. Since reinstalls require a pull from the remote, this broke a contract between the resolver and the planner which must always agree on which packages should come from the remote. This further demonstrates that we should be constructing the install plan with more concrete knowledge from the resolver (i.e. ResolvedDist instead of Requirement) to avoid having to manually ensure logic matches.

Test plan

Fails on main with panic succeeds on branch

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

@zanieb zanieb added the bug Something isn't working label Apr 2, 2024
@zanieb zanieb marked this pull request as ready for review April 2, 2024 16:30
@zanieb
Copy link
Copy Markdown
Member Author

zanieb commented Apr 2, 2024

Investigating a unit test

@zanieb zanieb requested a review from charliermarsh April 2, 2024 16:31
@charliermarsh
Copy link
Copy Markdown
Member

Feel free to add a test + merge (or I can re-review if you'd like).

zanieb added a commit that referenced this pull request Apr 2, 2024
@zanieb zanieb merged commit 119d753 into main Apr 2, 2024
@zanieb zanieb deleted the zb/fix-multiple-installed branch April 2, 2024 17:10
zanieb added a commit that referenced this pull request Apr 2, 2024
…ordering (#2780)

Originally a regression test for #2779 but we found out that there's
some weird behavior where different `anyio` versions were preferred
based on the platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants