I was trying to get a jupyter notebook working on binder. It has a dependency on librosa. All the dependencies get installed through the requirements.txt file, but when I try to run the code, I get an error when trying to import librosa:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
File /srv/conda/envs/notebook/lib/python3.8/site-packages/soundfile.py:151
150 if _libname is None:
--> 151 raise OSError('sndfile library not found')
152 _snd = _ffi.dlopen(_libname)
OSError: sndfile library not found
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
File /srv/conda/envs/notebook/lib/python3.8/site-packages/soundfile.py:178
177 try: # packaged libsndfile:
--> 178 _snd = _ffi.dlopen(_os.path.join(_path, '_soundfile_data', _packaged_libname))
179 except OSError: # try system-wide libsndfile:
180 # Homebrew on Apple M1 uses a `/opt/homebrew/lib` instead of
181 # `/usr/local/lib`. We are making sure we pick that up.
OSError: cannot load library '/srv/conda/envs/notebook/lib/python3.8/site-packages/_soundfile_data/libsndfile.so': /srv/conda/envs/notebook/lib/python3.8/site-packages/_soundfile_data/libsndfile.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import librosa
2 import librosa.display
3 import numpy as np
File /srv/conda/envs/notebook/lib/python3.8/site-packages/librosa/__init__.py:209
207 # And all the librosa sub-modules
208 from ._cache import cache
--> 209 from . import core
210 from . import beat
211 from . import decompose
File /srv/conda/envs/notebook/lib/python3.8/site-packages/librosa/core/__init__.py:6
3 """ Core IO and DSP functions"""
5 from .convert import * # pylint: disable=wildcard-import
----> 6 from .audio import * # pylint: disable=wildcard-import
7 from .spectrum import * # pylint: disable=wildcard-import
8 from .pitch import * # pylint: disable=wildcard-import
File /srv/conda/envs/notebook/lib/python3.8/site-packages/librosa/core/audio.py:8
5 import pathlib
6 import warnings
----> 8 import soundfile as sf
9 import audioread
10 import numpy as np
File /srv/conda/envs/notebook/lib/python3.8/site-packages/soundfile.py:189
186 _snd = _ffi.dlopen(_os.path.join(_hbrew_path, _libname))
187 else:
188 # Try explicit file name, if the general does not work (e.g. on nixos)
--> 189 _snd = _ffi.dlopen(_libname)
191 __libsndfile_version__ = _ffi.string(_snd.sf_version_string()).decode('utf-8', 'replace')
192 if __libsndfile_version__.startswith('libsndfile-'):
OSError: cannot load library 'libsndfile.so': libsndfile.so: cannot open shared object file: No such file or directory
Import fails due to sndfile library missing on the server. How do I fix this? Attaching requirements.txt
contents below:
jenkspy==0.3.2
librosa==0.9.2
matplotlib==3.6.2
numpy==1.23.5