Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: cffi library '(pyModulesPath)\_soundfile_data\libsndfile64bit.dll' has no function, constant or global variable named 'sf_wchar_open'

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.

like image 677
SF12 Study Avatar asked Jan 26 '20 04:01

SF12 Study


2 Answers

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

like image 102
Red Prado Avatar answered Sep 28 '22 06:09

Red Prado


please upgrade soundfile, use: pip install -U soundfile

like image 39
feifei Xiao Avatar answered Sep 28 '22 06:09

feifei Xiao