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:
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:
conda install -n base libarchive -c main --force-reinstall --solver classic
After installation, restart your terminal and verify the fix:
conda list | grep libarchive
# Should show: libarchive 3.7.4 or later
Reinstall Related Packages from Consistent Channel
Ensure all conda-libmamba-solver
dependencies come from the same channel. For conda-forge
:
conda install --solver=classic \
conda-forge::conda-libmamba-solver \
conda-forge::libmamba \
conda-forge::libmambapy \
conda-forge::libarchive
If you prefer the defaults
channel:
conda install -c main conda-libmamba-solver libmamba libarchive
Align Channels Systematically
Fix channel conflicts by standardizing to a single channel:
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:
- Find the library path:
sudo find / -name libarchive.so.19 2>/dev/null
- Temporarily add to library path:
export LD_LIBRARY_PATH=/found/path:$LD_LIBRARY_PATH
- Proceed with installing the solver:
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
- Channel Consistency: Always install related packages (
libmamba
,libarchive
,conda-libmamba-solver
) from the same channel - Solver Specification: Use
--solver=classic
when resolving package conflicts until compatibility is restored - Base Environment Care: Avoid mixing channels in your base Conda environment
After applying these solutions, you can safely re-enable the libmamba solver:
conda config --set solver libmamba