Conversation
aoright
force-pushed
the
fix-pypi-to-conda-preserved-files
branch
from
September 18, 2026 12:44
cd156f4 to
20329b0
Compare
… to conda When updating an environment where a package previously installed from PyPI is switched to a conda dependency, conda extracts the package files into the environment prefix first. In the subsequent PyPI update phase, the old PyPI distribution was identified as extraneous (if only one distribution remained or conda did not write a separate dist-info). Calling remove_packages then invoked uv_installer::uninstall, which walked the old PyPI RECORD file and deleted all the files that conda had just extracted. To fix this, pass conda package names from pixi_records (including both conda package names and PyPI purl names) to InstallPlanner. When an installed package matches a conda-provided package and is no longer required from PyPI, treat it as duplicate metadata rather than extraneous. remove_duplicate_metadata then removes only the stale PyPI dist-info directory without deleting any package source files. Fixes prefix-dev#6902 Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>
aoright
force-pushed
the
fix-pypi-to-conda-preserved-files
branch
from
September 18, 2026 13:25
20329b0 to
a462ee0
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When an environment is updated such that a package previously installed via PyPI is moved to conda dependencies, conda installs the conda package into the environment prefix first.
During the subsequent PyPI update phase,
InstallPlanner::planinspectssite-packages. Previously, packages not inrequired_distswere partitioned intoduplicatesonly ifdists.len() > 1. If conda did not install a separate.dist-info(or replaced it, or only module files exist),dists.len() == 1, causing the old PyPI package to be classified asextraneous. Thenremove_packagesinvokeduv_installer::uninstall(dist), which read the old PyPIRECORDfile and deleted all the files that conda had just extracted intosite-packages/.This PR fixes this by:
pixi_recordsduring planning setup.conda_packagestoInstallPlanner.duplicateswhendists.len() > 1 || self.conda_packages.contains(name).remove_duplicate_metadataremoves only the stale PyPI.dist-infodirectory without callinguv_installer::uninstall, leaving the conda-installed package files intact.Fixes #6902
How Has This Been Tested?
test_conda_package_not_extraneous_when_replacing_pypiincrates/pixi_install_pypi/src/plan/test/mod.rs.cargo test -p pixi_install_pypiacross unit and integration tests.cargo clippy -p pixi_install_pypi --all-targetsandcargo fmt --check.AI Disclosure
Tools: Google Antigravity
Checklist: