Solution to the error "Error while loading conda entry point: conda-libmamba-solver" when installing Mamba on MacOS

1 What is Conda?

Conda (Anaconda, Miniconda) is a powerful and comprehensive package management and environment management tool (it can be understood as an application supermarket). It is a boon for installing software for biotech workers who are not so proficient in computer skills. . However, he has one of the most fatal flaws, which is "slowness" !

Many biometric tools require other dependencies, especially when there are many dependency packages. If you use conda to install the software, you may still only see a few lines of code jumping around repeatedly after a night...even many times Just fail it

Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: / 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
......

2 What is Mamba?

Mamba is an open source Python distribution and a replacement for Conda. Its usage is exactly the same as Conda, but its speed is not even a little faster than Conda.

Especially when installing software like BUSCO, which has many dependencies and large files, the advantages are very obvious.

3 How to Install Mamba?

Mamba has 2 installation methods:

        1. Directly use Mambaforge/Miniforge instead of Anaconda/Miniconda (official recommendation)

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh

#或者下载安装包进行本地 bash 安装:
#https://github.com/conda-forge/miniforge

        2. Install mamba in Conda’s base environment (officially not recommended)

conda install -n base -c conda-forge mamba

For the first installation method, you need to replace all conda commands with mamba, for example:

mamba list
mamba env list
mamba create -n busco
mamba install -c bioconda busco

For people who are used to using conda, switching may not be comfortable and they still want to use conda commands. At this time, many people will choose the second installation method (me too.)

4 Troubleshooting While Using Mamba Under Conda's Environment

However, an error often occurs when installing using the second method (Linux/MacOS):

#Linux
Error while loading conda entry point: conda-libmamba-solver (/home/${USER}/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libmamba.so.2: undefined symbol: archive_read_support_filter_zstd)

#用户名用${USER}代替

The error content mentioned: undefined symbol: archive_read_support _filter_zstd

Means lack of support for archives (compressed files)

After some troubles, I found that libarchive may be missing   . This is a C library used to process files in compressed formats such as tar, ZIP, and 7-Zip. This is one of the dependencies of mamba.

In order to solve this error, you can try to install this library first, such as using conda to install:

conda install -c conda-forge libarchive

conda will install related content:

## Package Plan ##

  environment location: /home/${USER}/miniconda3

  added / updated specs:
    - libarchive


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libarchive-3.6.2           |       h3d51595_0         816 KB  conda-forge
    lzo-2.10                   |    h516909a_1000         314 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         1.1 MB

The following NEW packages will be INSTALLED:

  lzo                conda-forge/linux-64::lzo-2.10-h516909a_1000 

The following packages will be SUPERSEDED by a higher-priority channel:

  libarchive         pkgs/main::libarchive-3.6.2-h6ac8c49_2 --> conda-forge::libarchive-3.6.2-h3d51595_0

After the installation is complete, try using conda or mamba to see if errors still occur, such as:

conda --version
conda list
conda env list
mamba info
...

If no error occurs, congratulations, you can happily use mamba!

But for MacOS users, the error often remains the same (me too...)

Check that the libarchive library has been installed, but there is still an error:

#MacOS
Error while loading conda entry point: conda-libmamba-solver (dlopen(/Users/${USER}/miniconda3/lib/python3.11/site-packages/libmambapy/bindings.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libarchive.13.dylib
  Referenced from: <C8DA2B44-4ACA-376E-BAFF-572CA6EBD14D> /Users/${USER}/miniconda3/lib/libmamba.2.0.0.dylib
  Reason: tried: '/Users/${USER}/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/${USER}/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.13.dylib' (no such file), '/Users/${USER}/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.13.dylib' (no such file), '/Users/${USER}/miniconda3/bin/../lib/libarchive.13.dylib' (no such file), '/Users/${USER}g/miniconda3/bin/../lib/libarchive.13.dylib' (no such file), '/usr/local/lib/libarchive.13.dylib' (no such file), '/usr/lib/libarchive.13.dylib' (no such file, not in dyld cache))
WARNING conda.plugins.manager:load_entrypoints(114): Error while loading conda entry point: conda-libmamba-solver (dlopen(/Users/${USER}/miniconda3/lib/python3.11/site-packages/libmambapy/bindings.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libarchive.13.dylib
  Referenced from: <C8DA2B44-4ACA-376E-BAFF-572CA6EBD14D> /Users/${USER}/miniconda3/lib/libmamba.2.0.0.dylib
  Reason: tried: '/Users/${USER}/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/${USER}/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.13.dylib' (no such file), '/Users/${USER}/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.13.dylib' (no such file), '/Users/${USER}/miniconda3/bin/../lib/libarchive.13.dylib' (no such file), '/Users/${USER}/miniconda3/bin/../lib/libarchive.13.dylib' (no such file), '/usr/local/lib/libarchive.13.dylib' (no such file), '/usr/lib/libarchive.13.dylib' (no such file, not in dyld cache))

#用户名用${USER}代替

You can see the error message that the file cannot be found: libarchive.13.dylib

This file is the dynamic link library file of the libarchive library on the MacOS system and cannot be loaded when running mamba.

So look for this file on your computer:

sudo find / -name libarchive.13.dylib -print

#Result:
/usr/local/Cellar/libarchive/3.7.1/lib/libarchive.13.dylib

Link the above files to the missing path mentioned in the error:

ln -s /usr/local/Cellar/libarchive/3.7.1/lib/libarchive.13.dylib /Users/${USER}/miniconda3/lib/

After the link is successful, the mamba error problem is solved:

5 At the End

If Mac cannot find the libarchive library, you can consider installing it locally and then linking to it, such as using Homebrew to install:

#Make sure you have Homebrew installed on your Mac!
brew install libarchive

In addition, the dynamic link library of Linux's libarchive library is different from that of MacOS. The prefix is ​​libarchive.so

If a similar error occurs, you can try to use the link method to solve it.

Guess you like

Origin blog.csdn.net/Xylonwin/article/details/132724517