mamba: Library not loaded: @rpath/libarchive.13.dyli on M1 Mac

Any mamba command results in the following error for me. I use a M1 Macbook and a fresh miniconda installation. Mamba was installed using conda install mamba -n base -c conda-forge.

Traceback (most recent call last):
  File "/Users/kdubovikov/miniconda3/bin/mamba", line 7, in <module>
    from mamba.mamba import main
  File "/Users/kdubovikov/miniconda3/lib/python3.9/site-packages/mamba/mamba.py", line 53, in <module>
    import mamba.mamba_api as api
ImportError: dlopen(/Users/kdubovikov/miniconda3/lib/python3.9/site-packages/mamba/mamba_api.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/libarchive.13.dylib
  Referenced from: /Users/kdubovikov/miniconda3/lib/python3.9/site-packages/mamba/mamba_api.cpython-39-darwin.so
  Reason: tried: '/Users/kdubovikov/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/lib/python3.9/site-packages/mamba/../../../libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/lib/python3.9/site-packages/mamba/../../../libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/bin/../lib/libarchive.13.dylib' (no such file), '/Users/kdubovikov/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/kdubovikov/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)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 17
  • Comments: 33 (6 by maintainers)

Most upvoted comments

I have installed libarchive with conda install libarchive -n base -c conda-forge and now everything works. Maybe mamba dependencies in conda-forge should be modified to include libarchive for Apple Silicon.

i’ve experienced the same problem, and the hack proposed above works. conda install libarchive -n base -c conda-forge

I had the same problem and tried method of @kdubovikov but the problem still exists. Then tried the answer from here and successed:

brew install libarchive
ln -s /usr/local/opt/libarchive/lib/libarchive.13.dylib /usr/local/lib/

I had the same problem and tried method of @kdubovikov but the problem still exists. Then tried the answer from here and successed:

brew install libarchive
ln -s /usr/local/opt/libarchive/lib/libarchive.13.dylib /usr/local/lib/

Worked for me. thanks!

Experienced the same problem, with the same solution. With the pkgs/main version of libarchive 3.5.2, there’s a libarchive.18.dylib in ~/miniconda3/lib, but no libarchive.13.dylib. With the conda-forge version, there’s a libarchive.13.dylib, which mamba expects.

I had a very similar issue on my new M2 MacBook Pro. I found that a number of conda packages were not appearing for me in conda search even though I know they are distributed on bioconda. I found another thread that helped me fix that, using this command:

conda config --add subdirs osx-64

However, upon installing one of the desired tools, I had the same sort of “Library not loaded” as described by OP. After some frustration, I realized that there is a very simple solution. First, I noticed that my /usr/local directory doesn’t contain a lib subdirectory. So I just did the following, linking my Homebrew lib to /usr/local and that seems to be working:

sudo ln -s /opt/homebrew/lib/ /usr/local/lib

If you’re open to trying Micromamba: it doesn’t have those kinds of problems.