Skip to content

Fixing conda-libmamba-solver libarchive.so.19 Error After Conda Update

Problem Statement

After updating Conda to version 23.11.0 or later, you may encounter the following error when running conda commands:

bash
Error while loading conda entry point: conda-libmamba-solver (libarchive.so.19: cannot open shared object file: No such file or directory)

This occurs even if you've set the solver to classic with conda config --set solver classic. The error stems from a version mismatch between libarchive and libmamba packages, particularly when installed from mixed channels (defaults vs conda-forge). This prevents Conda from locating the required shared library file (libarchive.so.19).

Solutions

Reinstall libarchive from Main Channel

Reinstall libarchive from Conda's main channel using the classic solver:

bash
conda install -n base libarchive -c main --force-reinstall --solver classic

After installation, restart your terminal and verify the fix:

bash
conda list | grep libarchive
# Should show: libarchive 3.7.4 or later

Ensure all conda-libmamba-solver dependencies come from the same channel. For conda-forge:

bash
conda install --solver=classic \
    conda-forge::conda-libmamba-solver \
    conda-forge::libmamba \
    conda-forge::libmambapy \
    conda-forge::libarchive

If you prefer the defaults channel:

bash
conda install -c main conda-libmamba-solver libmamba libarchive

Align Channels Systematically

Fix channel conflicts by standardizing to a single channel:

bash
conda config --remove channels defaults
conda config --add channels conda-forge
conda update --all

WARNING

This solution changes your default channels and updates all packages. It may result in significant package changes.

Alternative Fix for Severe Cases

If conda commands immediately fail due to the error:

  1. Find the library path:
bash
sudo find / -name libarchive.so.19 2>/dev/null
  1. Temporarily add to library path:
bash
export LD_LIBRARY_PATH=/found/path:$LD_LIBRARY_PATH
  1. Proceed with installing the solver:
bash
conda install --force-reinstall conda-libmamba-solver

Explanation

The error occurs because Conda's libmamba solver requires specific libarchive library versions. When packages come from different channels (e.g., libmamba from conda-forge and libarchive from defaults), version incompatibilities prevent Conda from locating the required shared object file.

Best Practices

  1. Channel Consistency: Always install related packages (libmamba, libarchive, conda-libmamba-solver) from the same channel
  2. Solver Specification: Use --solver=classic when resolving package conflicts until compatibility is restored
  3. Base Environment Care: Avoid mixing channels in your base Conda environment

After applying these solutions, you can safely re-enable the libmamba solver:

bash
conda config --set solver libmamba