6

When I try to use anything that's related to the module librosa, I get an error:

Traceback (most recent call last):
  File "C:\Users\User1\Documents\test3.py", line 36, in <module>
    x, Fs = librosa.load(fn_mp3, sr=None)
  File "C:\Program Files\Python38\lib\site-packages\librosa\core\audio.py", line 129, in load
    with sf.SoundFile(path) as sf_desc:
  File "C:\Program Files\Python38\lib\site-packages\soundfile.py", line 629, in __init__
    self._file = self._open(file, mode_int, closefd)
  File "C:\Program Files\Python38\lib\site-packages\soundfile.py", line 1172, in _open
    openfunction = _snd.sf_wchar_open
AttributeError: cffi library 'C:\Program Files\Python38\lib\site-packages\_soundfile_data\libsndfile64bit.dll' has no function, constant or global variable named 'sf_wchar_open'

Before I had an error with something about libsndfile64bit.dll then I created a folder in site-packages called _soundfile_data and downloaded libsndfile64bit.dll from here then added it to the folder then the error I provided popped up. I have tried searching on SO for answers but there are no questions related, I cannot edit libsndfile64bit.dll therefore I cannot do anything. I'm on Windows OS 64x, Python 3.8 and librosa 0.7.2.

SF12 Study
  • 375
  • 4
  • 18

4 Answers4

8

I tried @Maos Tamir answer but didn't worked
What worked for me:


1.- Open anaconda prompt
2.-activate the desired venv
If Originally installed with conda:
3.- conda uninstall librosa
4.-pip uninstall soundfile
5.- pip install librosa
6.- Close prompt
7.- restart kernel if using jupyter notebooks

Red Prado
  • 81
  • 1
  • 3
2

please upgrade soundfile, use: pip install -U soundfile

  • I'm new to pyhton, pip, conda and jupyter notbooks but this answer fixed the error i was having. pip replaced SoundFile-0.10.2 (installed by conda) with soundfile-0.10.3.post1 – mrfelis Nov 17 '20 at 03:03
0

Had the same issue in Windows 10 with Python 3.7.9. Try manually download the appropriate windows wheel, and install it manually from https://github.com/bastibe/SoundFile/releases/tag/0.10.3post1

Maoz Tamir
  • 51
  • 4
0

I got this error too, the way I worked around it was by implementing a suggestion from another thread and downgrading to python 3.7:

conda create -n p37env python=3.7
conda activate p37env
conda install -c conda-forge librosa

Librosa should automatically install soundfile properly. Also make sure if you are using JupyterLab/JupyterNotebook, open the JupyterLab/Notebook session from the same environment where the python was downgraded to python 3.7, I forgot to do that and got the error again until I realized it.

Source for the solution of the first 2 commands: (Unable to install tensorflow using conda with python 3.8)

wooshuwu
  • 133
  • 1
  • 3