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

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

Open
kdubovikov opened this issue Jul 27, 2022 · 33 comments
Open

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

kdubovikov opened this issue Jul 27, 2022 · 33 comments
Labels
type::bug Something isn't working

Comments

@kdubovikov
Copy link

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)
@wolfv
Copy link
Member

wolfv commented Jul 27, 2022

can you send me your conda list? Is libarchive installed from the conda-forge channel?

I would advise you to start from mambaforge: https://github.com/conda-forge/miniforge#mambaforge

@kdubovikov
Copy link
Author

@wolfv , wow, that's a quick reply. Thank you.

# packages in environment at /Users/kdubovikov/miniconda3:
#
# Name                    Version                   Build  Channel
boto3                     1.24.28          py39hca03da5_0  
botocore                  1.27.28          py39hca03da5_0  
brotlipy                  0.7.0           py39h1a28f6b_1002  
ca-certificates           2022.07.19           hca03da5_0  
certifi                   2022.6.15        py39hca03da5_0  
cffi                      1.15.0           py39h22df2f2_1  
charset-normalizer        2.0.4              pyhd3eb1b0_0  
conda                     4.13.0           py39hca03da5_0  
conda-package-handling    1.8.1            py39h1a28f6b_0  
cryptography              37.0.1           py39h834c97f_0  
idna                      3.3                pyhd3eb1b0_0  
jmespath                  0.10.0             pyhd3eb1b0_0  
libcxx                    12.0.0               hf6beb65_1  
libffi                    3.4.2                hc377ac9_4  
ncurses                   6.3                  h1a28f6b_3  
openssl                   1.1.1q               h1a28f6b_0  
pip                       22.1.2           py39hca03da5_0  
pycosat                   0.6.3            py39h1a28f6b_0  
pycparser                 2.21               pyhd3eb1b0_0  
pyopenssl                 22.0.0             pyhd3eb1b0_0  
pysocks                   1.7.1            py39hca03da5_0  
python                    3.9.12               hbdb9e5c_0  
python-dateutil           2.8.2              pyhd3eb1b0_0  
python.app                3                py39h1a28f6b_0  
readline                  8.1.2                h1a28f6b_1  
requests                  2.28.1           py39hca03da5_0  
ruamel_yaml               0.15.100         py39h1a28f6b_0  
s3transfer                0.6.0            py39hca03da5_0  
setuptools                61.2.0           py39hca03da5_0  
six                       1.16.0             pyhd3eb1b0_1  
sqlite                    3.38.5               h1058600_0  
tk                        8.6.12               hb8d0fd4_0  
tqdm                      4.64.0           py39hca03da5_0  
tzdata                    2022a                hda174b7_0  
urllib3                   1.26.9           py39hca03da5_0  
wheel                     0.37.1             pyhd3eb1b0_0  
xz                        5.2.5                h1a28f6b_1  
yaml                      0.2.5                h1a28f6b_0  
zlib                      1.2.12               h5a0b063_2 

I don't think that libarchive is installed, but I expected that to be installed as a dependency since the installation manual did not say to install it manually

@kdubovikov
Copy link
Author

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.

@wolfv
Copy link
Member

wolfv commented Jul 27, 2022

mamba is also not in your conda list output?
libarchive should definitely be installed. I also think it is needed for conda-package-handling. Very weird.

@kdubovikov
Copy link
Author

@wolfv I've actually removed mamba right before doing conda list so that's why it isn't there. I have re-installed it again after that.

@kdubovikov
Copy link
Author

Also, I don't see libarchive as a dependency for conda-package-handling:

conda-package-handling[1.8.1]
  ├─ python[3.9.13]
  │  ├─ bzip2[1.0.8]
  │  ├─ libffi[3.4.2]
  │  │  └─ libcxx[14.0.6]
  │  ├─ libzlib[1.2.12]
  │  ├─ ncurses[6.3]
  │  ├─ openssl[1.1.1q]
  │  │  └─ ca-certificates[2022.6.15]
  │  ├─ readline[8.1.2]
  │  │  └─ ncurses already visited
  │  ├─ sqlite[3.38.5]
  │  │  ├─ readline already visited
  │  │  └─ zlib[1.2.12]
  │  ├─ tk[8.6.12]
  │  │  └─ zlib already visited
  │  ├─ tzdata[2022a]
  │  ├─ xz[5.2.5]
  │  └─ pip[22.1.2]
  │     ├─ setuptools[61.2.0]
  │     │  ├─ certifi[2022.6.15]
  │     │  │  └─ python_abi[3.9]
  │     ├─ wheel[0.37.1]
  │     ├─ solvable:prereqmarker >>> NOT FOUND <<<
  └─ tqdm[4.64.0]
     └─ python already visited

@wolfv
Copy link
Member

wolfv commented Jul 27, 2022

interesting. It's definitely required for mamba, though. Do you have a new conda list? I think things would work if you also pass --strict-channel-priority.

@kdubovikov
Copy link
Author

Sure, here is a new one

# packages in environment at /Users/kdubovikov/miniconda3:
#
# Name                    Version                   Build  Channel
boto3                     1.24.28          py39hca03da5_0  
botocore                  1.27.28          py39hca03da5_0  
brotlipy                  0.7.0           py39h1a28f6b_1002  
bzip2                     1.0.8                h3422bc3_4    conda-forge
c-ares                    1.18.1               h3422bc3_0    conda-forge
ca-certificates           2022.07.19           hca03da5_0  
certifi                   2022.6.15        py39h2804cbe_0    conda-forge
cffi                      1.15.0           py39h22df2f2_1  
charset-normalizer        2.0.4              pyhd3eb1b0_0  
conda                     4.13.0           py39h2804cbe_1    conda-forge
conda-package-handling    1.8.1            py39h1a28f6b_0  
cryptography              37.0.1           py39h834c97f_0  
icu                       68.2                 hbdafb3b_0    conda-forge
idna                      3.3                pyhd3eb1b0_0  
jmespath                  0.10.0             pyhd3eb1b0_0  
krb5                      1.19.3               hf9b2bbe_0    conda-forge
libarchive                3.5.2                h69ec738_3    conda-forge
libcurl                   7.83.1               h2fcd78c_0    conda-forge
libcxx                    14.0.6               h04bba0f_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h642e427_1    conda-forge
libffi                    3.4.2                hc377ac9_4  
libiconv                  1.16                 h642e427_0    conda-forge
libmamba                  0.25.0               h1c735bf_1    conda-forge
libmambapy                0.25.0           py39h5b36d7b_1    conda-forge
libnghttp2                1.47.0               he723fca_0    conda-forge
libpq                     12.9                 h65cfe13_3  
libsolv                   0.7.22               h1280f1d_0    conda-forge
libssh2                   1.10.0               hb80f160_2    conda-forge
libxml2                   2.9.14               h8c5e841_0  
libzlib                   1.2.12               ha287fd2_2    conda-forge
lz4-c                     1.9.3                hbdafb3b_1    conda-forge
lzo                       2.10              h642e427_1000    conda-forge
mamba                     0.25.0           py39hde45b87_1    conda-forge
ncurses                   6.3                  h1a28f6b_3  
openssl                   1.1.1q               ha287fd2_0    conda-forge
pip                       22.1.2           py39hca03da5_0  
psycopg2                  2.8.6            py39hf27765b_1  
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.3            py39h1a28f6b_0  
pycparser                 2.21               pyhd3eb1b0_0  
pyopenssl                 22.0.0             pyhd3eb1b0_0  
pysocks                   1.7.1            py39hca03da5_0  
python                    3.9.13          hc596b02_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd3eb1b0_0  
python.app                3                py39h1a28f6b_0  
python_abi                3.9                      2_cp39    conda-forge
readline                  8.1.2                h1a28f6b_1  
reproc                    14.2.3               h3422bc3_0    conda-forge
reproc-cpp                14.2.3               hbdafb3b_0    conda-forge
requests                  2.28.1           py39hca03da5_0  
ruamel_yaml               0.15.100         py39h1a28f6b_0  
s3transfer                0.6.0            py39hca03da5_0  
setuptools                61.2.0           py39hca03da5_0  
six                       1.16.0             pyhd3eb1b0_1  
sqlite                    3.38.5               h1058600_0  
tk                        8.6.12               hb8d0fd4_0  
tqdm                      4.64.0           py39hca03da5_0  
tzdata                    2022a                hda174b7_0  
urllib3                   1.26.9           py39hca03da5_0  
wheel                     0.37.1             pyhd3eb1b0_0  
xz                        5.2.5                h1a28f6b_1  
yaml                      0.2.5                h1a28f6b_0  
yaml-cpp                  0.7.0                h9a09cb3_1    conda-forge
zlib                      1.2.12               h5a0b063_2  
zstd                      1.5.2                h861e0a7_0    conda-forge

@bjarthur
Copy link

bjarthur commented Aug 5, 2022

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

@nisheethlahoti
Copy link

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.

@marimeireles
Copy link
Member

I was installing some specific packages for my environment install libllvm15 lit llvm llvm-tools llvmdev that really messed up some of my paths!
Still reproducing this error and didn't find a way to go around it.
My solution was uninstalling everything and starting over with a clean installation.

@JovanVeljanoski
Copy link

JovanVeljanoski commented Feb 1, 2023

Hi,

I am getting a similar problem after upgrading mamba in the base env from 1.0.0 to 1.2.0.

Traceback (most recent call last):
  File "/Users/jovan/miniconda3/bin/mamba", line 7, in <module>
    from mamba.mamba import main
  File "/Users/jovan/miniconda3/lib/python3.8/site-packages/mamba/mamba.py", line 49, in <module>
    import libmambapy as api
  File "/Users/jovan/miniconda3/lib/python3.8/site-packages/libmambapy/__init__.py", line 7, in <module>
    raise e
  File "/Users/jovan/miniconda3/lib/python3.8/site-packages/libmambapy/__init__.py", line 4, in <module>
    from libmambapy.bindings import *  # noqa: F401,F403
ImportError: dlopen(/Users/jovan/miniconda3/lib/python3.8/site-packages/libmambapy/bindings.cpython-38-darwin.so, 0x0002): Library not loaded: @rpath/libarchive.13.dylib
  Referenced from: <DC674B59-AD78-3A3E-9D76-D190B3490F4D> /Users/jovan/miniconda3/lib/libmamba.2.0.0.dylib
  Reason: tried: '/Users/jovan/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/jovan/miniconda3/lib/python3.8/site-packages/libmambapy/../../../libarchive.13.dylib' (no such file), '/Users/jovan/miniconda3/lib/python3.8/site-packages/libmambapy/../../../libarchive.13.dylib' (no such file), '/Users/jovan/miniconda3/bin/../lib/libarchive.13.dylib' (no such file), '/Users/jovan/miniconda3/bin/../lib/libarchive.13.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libarchive.13.dylib' (no such file), '/Users/jovan/miniconda3/lib/libarchive.13.dylib' (no such file), '/Users/jovan/miniconda3/lib/python3.8/site-packages/libmambapy/../../../libarchive.13.dylib' (no such file), '/Users/jovan/miniconda3/lib/python3.8/site-packages/libmambapy/../../../libarchive.13.dylib' (no such file), '/Users/jovan/miniconda3/bin/../lib/libarchive.13.dylib' (no such file), '/Users/jovan/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)

The hack of re-installing mamba and/or libarchive did not work..

Here is a my conda list if that helps

# Name                    Version                   Build  Channel
appnope                   0.1.2            py38h10201cd_2    conda-forge
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
awscli                    1.22.74          py38h10201cd_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
botocore                  1.24.19            pyhd8ed1ab_0    conda-forge
brotlipy                  0.7.0           py38hea4295b_1003    conda-forge
bzip2                     1.0.8                h3422bc3_4    conda-forge
c-ares                    1.18.1               h3422bc3_0    conda-forge
ca-certificates           2022.12.7            h4653dfc_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.0           py38hc67bbb8_0    conda-forge
chardet                   4.0.0           py38hca03da5_1003  
charset-normalizer        2.0.12             pyhd8ed1ab_0    conda-forge
colorama                  0.4.3                      py_0    conda-forge
commonmark                0.9.1                      py_0    conda-forge
conda                     22.11.1          py38h10201cd_1    conda-forge
conda-package-handling    1.8.0            py38h33210d7_0    conda-forge
cryptography              38.0.2           py38h23f6d3d_2    conda-forge
curl                      7.87.0               h9049daf_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
distro                    1.6.0              pyhd8ed1ab_0    conda-forge
docutils                  0.15.2           py38h10201cd_3    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
expat                     2.4.7                h6b3803e_0    conda-forge
fmt                       9.1.0                hffc8910_0    conda-forge
future                    0.18.2           py38h10201cd_4    conda-forge
gettext                   0.21.1               h0186832_0    conda-forge
git                       2.35.1          pl5321hdb569e8_0    conda-forge
icu                       69.1                 hbdafb3b_0    conda-forge
idna                      3.3                pyhd8ed1ab_0    conda-forge
ipython                   8.1.1            py38h10201cd_0    conda-forge
jedi                      0.18.1           py38h10201cd_0    conda-forge
jmespath                  0.10.0             pyh9f0ad1d_0    conda-forge
krb5                      1.20.1               h69eda48_0    conda-forge
libarchive                3.6.2                h3d4dd14_0  
libblas                   3.9.0           16_osxarm64_openblas    conda-forge
libcblas                  3.9.0           16_osxarm64_openblas    conda-forge
libcurl                   7.87.0               h9049daf_0    conda-forge
libcxx                    14.0.6               h2692d47_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h642e427_1    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgfortran               5.0.0           11_3_0_hd922786_27    conda-forge
libgfortran5              11.3.0              hdaf2cc0_27    conda-forge
libiconv                  1.17                 he4db4b2_0    conda-forge
liblapack                 3.9.0           16_osxarm64_openblas    conda-forge
libmamba                  1.2.0                h7d1d596_0    conda-forge
libmambapy                1.2.0            py38hee20f4a_0    conda-forge
libnghttp2                1.47.0               h519802c_1    conda-forge
libopenblas               0.3.21          openmp_hc731615_3    conda-forge
libsolv                   0.7.23               hb5ab8b9_0    conda-forge
libssh2                   1.10.0               h7a5bd25_3    conda-forge
libxml2                   2.9.14               h815018a_4    conda-forge
libzlib                   1.2.13               h03a7124_4    conda-forge
llvm-openmp               15.0.7               h7cfbb63_0    conda-forge
lz4-c                     1.9.4                hb7217d7_0    conda-forge
lzo                       2.10              h642e427_1000    conda-forge
mamba                     1.2.0            py38hb2d7053_0    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  hc470f4d_0    conda-forge
numpy                     1.24.1           py38hac8ee1c_0    conda-forge
openssl                   3.0.7                h03a7124_2    conda-forge
pandas                    1.5.2            py38h61dac83_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pcre2                     10.37                hc5de063_0    conda-forge
perl                      5.32.1          2_h9b22ae9_perl5    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       22.0.4             pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0              pyhd8ed1ab_5    conda-forge
prompt-toolkit            3.0.27             pyha770c72_0    conda-forge
psutil                    5.9.0            py38hea4295b_0    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
py-cpuinfo                8.0.0              pyhd8ed1ab_0    conda-forge
pyasn1                    0.4.8                      py_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.3           py38hea4295b_1009    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.11.2             pyhd8ed1ab_0    conda-forge
pyopenssl                 22.0.0             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1            py38h10201cd_4    conda-forge
python                    3.8.13          hd3575e6_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python.app                3                py38h1230e6a_0  
python_abi                3.8                      2_cp38    conda-forge
pytz                      2022.7.1           pyhd8ed1ab_0    conda-forge
pyyaml                    5.4.1            py38hea4295b_1    conda-forge
readline                  8.1                  h1230e6a_0  
reproc                    14.2.3               h3422bc3_0    conda-forge
reproc-cpp                14.2.3               hbdafb3b_0    conda-forge
requests                  2.27.1             pyhd8ed1ab_0    conda-forge
rich                      11.2.0             pyhd8ed1ab_0    conda-forge
rsa                       4.7.2              pyh44b312d_0    conda-forge
ruamel.yaml               0.17.21          py38hb991d35_2    conda-forge
ruamel.yaml.clib          0.2.7            py38hb991d35_1    conda-forge
ruamel_yaml               0.15.100         py38h1230e6a_0  
s3transfer                0.5.2              pyhd8ed1ab_0    conda-forge
setuptools                60.9.3           py38h10201cd_0    conda-forge
six                       1.16.0             pyhd3eb1b0_0  
sqlite                    3.37.1               h7e3ccbd_0    conda-forge
sshuttle                  1.1.0              pyhd8ed1ab_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
textual                   0.1.17             pyhd8ed1ab_0    conda-forge
tiptop                    0.2.5              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               he1e0b03_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tqdm                      4.63.0             pyhd8ed1ab_0    conda-forge
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
typing-extensions         3.10.0.2             hd8ed1ab_0    conda-forge
typing_extensions         3.10.0.2           pyha770c72_0    conda-forge
urllib3                   1.26.8             pyhd8ed1ab_1    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xz                        5.2.10               h80987f9_1  
yaml                      0.2.5                h3422bc3_2    conda-forge
yaml-cpp                  0.7.0                hb7217d7_2    conda-forge
zlib                      1.2.13               h03a7124_4    conda-forge
zstd                      1.5.2                hf913c23_6    conda-forge

Any advice short of re-installing everything? (I would not want to use my other environments.. )

Edit: downgrading mamba to 1.0.0 makes things work again. I might keep it like this until I am in a position to do a re-install..

@jonashaag
Copy link
Collaborator

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

@JovanVeljanoski
Copy link

@jonashaag I am very open :). In fact I use micromamba docker for productionizing some projects. I would happily switch to either that or mambaforge as suggested by @wolfv when the current batch of projects wraps up..

@jasonvrogers
Copy link

Hi, I had the same issue on my M1 Mac when installing the latest mamba (1.3.1). As with @JovanVeljanoski, downgrading to 1.0.0 fixed the issue (did not try any of the versions in-between).

@hiber-niu
Copy link

hiber-niu commented Mar 10, 2023

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/

@analog-cbarber
Copy link
Contributor

Neither the libarchive install hacks work for me on my M1. I basically have just given up on using mamba for the last six months rather than spend many more hours experimenting with how to fix this. ;-(

@JovanVeljanoski
Copy link

I finally had some time in between projects, just reinstalled conda, reinstalled mamba, and had my environments all up and running with no problems in 10 mins (multiple environments). No problems. Probably reinstalling your conda/mamba env every 1-2 years is not that bad of an idea..

@analog-cbarber
Copy link
Contributor

I have a relatively new Mac M1 machine and set it up 6 months ago. There is a limit to how many experimental installs I am willing to do to work around bugs. The fact is that the mamba distribution is currently broken on the M1. It really should not be depending on files from outside the conda environment that might not exist or may not be compatible.

The M1 is a relatively new architecture, so it probably will still take a while before it gets supported routinely. :-(

@jmshea
Copy link

jmshea commented Mar 29, 2023

Same problem on M2 Mac. Installing libarchive via conda worked for me.

@nianlonggu
Copy link

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!

@ktmeaton
Copy link

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

I couldn't get any of the suggested fixes in these threads to work, so I switched to micromamba. My errors are all resolved, and env creation is shockingly fast now! Thanks for the tip :)

@acsbendi
Copy link

acsbendi commented Jul 28, 2023

I experienced the same error on an x86 Mac, but my libarchive was actually installed so conda install libarchive -n base -c conda-forge didn't work. I managed to figure out that somehow I ended up with the wrong version of the library, 19 instead of 13 and I managed to work around it by copying the 19 to the place of the 13 (I ran cp ./libarchive.19.dylib ./libarchive.13.dylib in the miniconda3 folder)

@dbrowneup
Copy link

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

@jonashaag
Copy link
Collaborator

Just so it doesn't get lost somewhere in the thread: Micromamba shouldn't have those problems, try that!

@Masterxilo
Copy link

Masterxilo commented Aug 11, 2023

same problem while building a Docker container:

RUN conda install mamba=0.15.3 -n base -c conda-forge
#19 [15/55] RUN mamba --version
#19 0.731 Traceback (most recent call last):
#19 0.731   File "/root/miniconda/bin/mamba", line 7, in <module>
#19 0.731     from mamba.mamba import main
#19 0.731   File "/root/miniconda/lib/python3.9/site-packages/mamba/mamba.py", line 53, in <module>
#19 0.731     import mamba.mamba_api as api
#19 0.731 ImportError: libarchive.so.13: cannot open shared object file: No such file or directory
#19 ERROR: process "/bin/bash -c mamba --version" did not complete successfully: exit code: 1

I added this after installing mamba before running mamba --version

RUN conda install libarchive -n base -c conda-forge
# strangely, this does nothing and just reports > # All requested packages already installed.

and I also added apt-get update & upgrade to the top of the Dockerfile, now everything seems to work...

@gernophil
Copy link

gernophil commented Aug 26, 2023

I ran into an error that might be related to this.
I made a complete fresh install of the latest miniconda (23.5.2) and installed mamba from conda-forge. I am unable to install anything using mamba, since it always throws this error:

ImportError: dlopen(~/miniconda3/lib/python3.11/site-packages/libmambapy/bindings.cpython-311-darwin.so, 2): Library not loaded: @rpath/libarchive.13.dylib Referenced from: ~/miniconda3/lib/libmamba.2.0.0.dylib Reason: image not found

On another machine I am running miniconda 23.1.0 in combination with mamba and it works perfect (and also did for a long time). So, I did the same on this machine and clean uninstalled miniconda 23.5.2 and replaced it with miniconda 23.1.0 and reinstalled mamba and now it works. There seems to be an incompatibility of mamba with the newest version of miniconda. Can anyone confirm this?

@tlvu
Copy link

tlvu commented Aug 30, 2023

I have

2023-08-30T16:42:44Z #11 0.733 Traceback (most recent call last):
2023-08-30T16:42:44Z #11 0.733 File "/opt/conda/bin/mamba", line 7, in <module>
2023-08-30T16:42:44Z #11 0.733 from mamba.mamba import main
2023-08-30T16:42:44Z #11 0.733 File "/opt/conda/lib/python3.11/site-packages/mamba/mamba.py", line 49, in <module>
2023-08-30T16:42:44Z #11 0.733 import libmambapy as api
2023-08-30T16:42:44Z #11 0.733 File "/opt/conda/lib/python3.11/site-packages/libmambapy/__init__.py", line 7, in <module>
2023-08-30T16:42:44Z #11 0.734 raise e
2023-08-30T16:42:44Z #11 0.734 File "/opt/conda/lib/python3.11/site-packages/libmambapy/__init__.py", line 4, in <module>
2023-08-30T16:42:44Z #11 0.734 from libmambapy.bindings import * # noqa: F401,F403
2023-08-30T16:42:44Z #11 0.735 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-08-30T16:42:44Z #11 0.735 ImportError: libarchive.so.13: cannot open shared object file: No such file or directory

From building this Dockerfile https://github.com/Ouranosinc/PAVICS-e2e-workflow-tests/blob/cb53fec969539440269b313d8424dd436451269d/docker/Dockerfile#L1-L9

FROM continuumio/miniconda3

# Use mamba for much improved performance over conda.
# The 'channel_priority strict' did help conda but it was not enough.
RUN conda update conda -n base && \
    conda install mamba -n base -c conda-forge -c defaults

mamba breaks right away on first use with the error above.

I am on Linux, not Mac but this is the only issue about libarchive.13 currently open so I thought I would centralize all the info here.

@jonashaag
Copy link
Collaborator

Don't mix conda-forge and defaults

@tlvu
Copy link

tlvu commented Aug 30, 2023

Don't mix conda-forge and defaults

With the ordering I used, conda-forge should have precedence over defaults.

@JoaquinKeller
Copy link

I did conda uninstall libarchive (so it went on using the libarchive from brew) and then conda update --all twice, I don't understand what's going on... but problem solved

@wangm23456
Copy link

I did conda uninstall libarchive (so it went on using the libarchive from brew) and then conda update --all twice, I don't understand what's going on... but problem solved

conda uninstall libarchive, and then, mamba disappeared: __mamba_exe:3: no such file or directory.

@profLewis
Copy link

just do:

mamba install pysqlite3

(or conda)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug Something isn't working
Projects
None yet
Development

No branches or pull requests