Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: RECORD not found issue #495

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ fn remove_old_python_distributions(
let current_python_packages = rip::find_distributions_in_venv(prefix.root(), &install_paths)
.into_diagnostic()
.with_context(|| format!("failed to determine the python packages installed for a previous version of python ({}.{})", python_version.0, python_version.1))?
.into_iter().filter(|d| d.installer.as_deref() != Some("conda")).collect_vec();
.into_iter().filter(|d| d.installer.as_deref() != Some("conda") && d.installer.is_some()).collect_vec();

let pb = progress::global_multi_progress()
.add(ProgressBar::new(current_python_packages.len() as u64));
Expand Down Expand Up @@ -510,6 +510,12 @@ fn determine_python_distributions_to_remove_and_install(
// Any package that is in the currently installed list that is NOT found in the lockfile is
// retained in the list to mark it for removal.
current_python_packages.retain(|current_python_packages| {
if current_python_packages.installer.is_none() {
// If this package has no installer, we can't make a reliable decision on whether to
// keep it or not. So we do not uninstall it.
return false;
}

if let Some(found_desired_packages_idx) =
desired_python_packages
.iter()
Expand Down