1

I am trying to import librosa in jupyter notebook

!pip3 install librosa
!pip3 install pysndfile
import librosa

Found this ERROR message:

OSError                                   Traceback (most recent call last)
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/soundfile.py:142, in <module>
   141 if _libname is None:
--> 142     raise OSError('sndfile library not found')
   143 _snd = _ffi.dlopen(_libname)

OSError: sndfile library not found

OSError: cannot load library '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib' (no such file)

Can someone help me to resolve this?

  • You probably need to [`brew install libsndfile`](https://formulae.brew.sh/formula/libsndfile) – C.Nivs Jul 21 '22 at 16:58
  • i installed it ```Warning: libsndfile 1.1.0 is already installed and up-to-date.``` @C.Nivs – nursatkakon Jul 21 '22 at 17:05
  • While it probably won't help in this particular case, your Jupyter experience going forward will benefit by using the current magic command with `pip`, i.e., `%pip install ` when installing inside a notebook. The `%pip` and corresponding `%conda` magic command were added to avoid issues commonly caused by using an exclamation point in conjunction with `pip` and `conda`. The modern magics insure the installs are to the environment backing the notebook, see [here](https://discourse.jupyter.org/t/why-users-can-install-modules-from-pip-but-not-from-conda/10722/4?u=fomightez). – Wayne Jul 21 '22 at 17:21

0 Answers0