question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot make Librosa run in Mac M1 in arm64 mode

See original GitHub issue

I have a Mac M1 and want to use tensorflow (which in a Mac M1 only runs in arm64 mode, AFAIK) and librosa. After installing miniforge, I could install numba and llvmlite for arm64:

conda install numba -c conda-forge
conda install llvmlite -c conda-forge

and then I could (apparently) install librosa with pip:

pip install librosa

But when trying to import librosa in python, it crashes:


>>> import librosa
Traceback (most recent call last):
  File "/Users/ajulian/miniforge3/envs/TF24_A3/lib/python3.8/site-packages/soundfile.py", line 143, in <module>
    _snd = _ffi.dlopen(_libname)
OSError: cannot load library '/usr/local/lib/libsndfile.dylib': dlopen(/usr/local/lib/libsndfile.dylib, 2): no suitable image found.  Did find:
	/usr/local/lib/libsndfile.dylib: mach-o, but wrong architecture
	/usr/local/Cellar/libsndfile/1.0.31/lib/libsndfile.1.dylib: mach-o, but wrong architecture

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ajulian/miniforge3/envs/TF24_A3/lib/python3.8/site-packages/librosa/__init__.py", line 211, in <module>
    from . import core
  File "/Users/ajulian/miniforge3/envs/TF24_A3/lib/python3.8/site-packages/librosa/core/__init__.py", line 6, in <module>
    from .audio import *  # pylint: disable=wildcard-import
  File "/Users/ajulian/miniforge3/envs/TF24_A3/lib/python3.8/site-packages/librosa/core/audio.py", line 8, in <module>
    import soundfile as sf
  File "/Users/ajulian/miniforge3/envs/TF24_A3/lib/python3.8/site-packages/soundfile.py", line 162, in <module>
    _snd = _ffi.dlopen(_os.path.join(
OSError: cannot load library '/Users/ajulian/miniforge3/envs/TF24_A3/lib/python3.8/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Users/ajulian/miniforge3/envs/TF24_A3/lib/python3.8/site-packages/_soundfile_data/libsndfile.dylib, 2): image not found
>>>

Software versions

macOS-11.2-arm64-i386-64bit
Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 15:50:57) 
[Clang 11.0.1 ]
NumPy 1.20.1
SciPy 1.6.0
Numba 0.52.0
llvmlite 0.35.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
albertojuliancommented, Apr 9, 2021

Hi, I could finally install librosa in my Mac M1 in arm64 mode the following way:

conda install numba -c conda-forge
conda install llvmlite -c conda-forge
conda install libsndfile -c conda-forge 
pip install librosa

So you can close the issue.

1reaction
wolfvcommented, Mar 8, 2021

Libsndfile isn’t and a migrator will migrate it on conda-forge

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to install Librosa on M1 Mac? - python
Yes, it is working (somehow). Using a workaround with miniforge it works like this: brew install miniforge. Create and activate new env:
Read more >
A new release for soundfile · Issue #325 · bastibe/python- ...
This is a continuation of the discussion in #310, where I'm working on packaging a new version of soundfile. It appears that the...
Read more >
M1 mac: mach-o file, but is an incompatible architecture ...
I think by default it looks for prebuilt wheels and if it can't find one it builds the extension locally from source. This...
Read more >
Installation — Numba 0.50.1 documentation
(Note that while the Raspberry Pi CPU is 64-bit, Raspbian runs it in 32-bit mode, so look at Installing on Linux ARMv7 Platforms...
Read more >
Package List — Spack 0.20.0.dev0 documentation
This extension defines a protcol that allows X window managers to better interact with the Mac OS X Aqua user interface when running...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found