python-soundfile
python-soundfile copied to clipboard
cffi library '*\Miniconda3\Library\bin\sndfile.dll' has no function, constant or global variable named 'sf_wchar_open'
when I want to use librosa.load() there is a error.
Please offer more information if you want our help.
Please offer more information if you want our help.
Traceback (most recent call last):
File "C:\Users\zhuguili\ruanjian\anaconda\lib\site-packages\soundfile.py", line 142, in <module>
raise OSError('sndfile library not found')
OSError: sndfile library not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/ruanjian/python_workspace/example/speech_class.py", line 4, in <module>
import librosa
File "C:\ruanjian\anaconda\lib\site-packages\librosa\__init__.py", line 12, in <module>
from . import core
File "C:\ruanjian\anaconda\lib\site-packages\librosa\core\__init__.py", line 126, in <module>
from .audio import * # pylint: disable=wildcard-import
File "C:\anaconda\lib\site-packages\librosa\core\audio.py", line 10, in <module>
import soundfile as sf
File "C:\ruanjian\anaconda\lib\site-packages\soundfile.py", line 163, in <module>
_path, '_soundfile_data', _libname))
OSError: cannot load library 'C:\ruanjian\anaconda\lib\site-packages\_soundfile_data\libsndfile64bit.dll': error 0x7e
It looks like the conda-forge
package libsndfile
is broken: https://github.com/conda-forge/libsndfile-feedstock/issues/14
Until this is fixed, you can try to uninstall the libsndfile
package with conda
and re-install the soundfile
module with pip
.
Hi @mgeier, could you please provide the proper pip
command to install libsndfile
? I have found this but I am not sure if this is the right one. When I uninstalled libsndfile
using conda
, it also uninstalled librosa
, so maybe I should just install librosa
using pip
instead and hopefully it will install libsndfile
using pip
as well. What do you think?
Actually, I just tried to re-install librosa
using pip
, but it didn't install libsndfile
. Here is exactly what I did in the Anaconda Prompt and the corresponding output:
(base) C:\WINDOWS\system32>pip install librosa
Collecting librosa
Using cached librosa-0.8.0.tar.gz (183 kB)
Collecting audioread>=2.0.0
Using cached audioread-2.1.8.tar.gz (21 kB)
Requirement already satisfied: numpy>=1.15.0 in c:\programdata\anaconda3\lib\site-packages (from librosa) (1.18.5)
Requirement already satisfied: scipy>=1.0.0 in c:\programdata\anaconda3\lib\site-packages (from librosa) (1.5.0)
Requirement already satisfied: scikit-learn!=0.19.0,>=0.14.0 in c:\programdata\anaconda3\lib\site-packages (from librosa) (0.23.1)
Requirement already satisfied: joblib>=0.14 in c:\programdata\anaconda3\lib\site-packages (from librosa) (0.16.0)
Requirement already satisfied: decorator>=3.0.0 in c:\programdata\anaconda3\lib\site-packages (from librosa) (4.4.2)
Collecting resampy>=0.2.2
Using cached resampy-0.2.2.tar.gz (323 kB)
Requirement already satisfied: numba>=0.43.0 in c:\programdata\anaconda3\lib\site-packages (from librosa) (0.50.1)
Collecting soundfile>=0.9.0
Using cached SoundFile-0.10.3.post1-py2.py3.cp26.cp27.cp32.cp33.cp34.cp35.cp36.pp27.pp32.pp33-none-win_amd64.whl (689 kB)
Collecting pooch>=1.0
Using cached pooch-1.2.0-py3-none-any.whl (47 kB)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\programdata\anaconda3\lib\site-packages (from scikit-learn!=0.19.0,>=0.14.0->librosa) (2.1.0)
Requirement already satisfied: six>=1.3 in c:\programdata\anaconda3\lib\site-packages (from resampy>=0.2.2->librosa) (1.15.0)
Requirement already satisfied: llvmlite<0.34,>=0.33.0.dev0 in c:\programdata\anaconda3\lib\site-packages (from numba>=0.43.0->librosa) (0.33.0+1.g022ab0f)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-packages (from numba>=0.43.0->librosa) (49.2.0.post20200714)
Requirement already satisfied: cffi>=1.0 in c:\programdata\anaconda3\lib\site-packages (from soundfile>=0.9.0->librosa) (1.14.0)
Requirement already satisfied: packaging in c:\programdata\anaconda3\lib\site-packages (from pooch>=1.0->librosa) (20.4)
Collecting appdirs
Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: requests in c:\programdata\anaconda3\lib\site-packages (from pooch>=1.0->librosa) (2.24.0)
Requirement already satisfied: pycparser in c:\programdata\anaconda3\lib\site-packages (from cffi>=1.0->soundfile>=0.9.0->librosa) (2.20)
Requirement already satisfied: pyparsing>=2.0.2 in c:\programdata\anaconda3\lib\site-packages (from packaging->pooch>=1.0->librosa) (2.4.7)
Requirement already satisfied: idna<3,>=2.5 in c:\programdata\anaconda3\lib\site-packages (from requests->pooch>=1.0->librosa) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\lib\site-packages (from requests->pooch>=1.0->librosa) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\programdata\anaconda3\lib\site-packages (from requests->pooch>=1.0->librosa) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\programdata\anaconda3\lib\site-packages (from requests->pooch>=1.0->librosa) (1.25.9)
Building wheels for collected packages: librosa, audioread, resampy
Building wheel for librosa (setup.py) ... done
Created wheel for librosa: filename=librosa-0.8.0-py3-none-any.whl size=201381 sha256=9e284782eab4f070050b42accb38b743072735f9794ccd5ee75d1df7f61353ba
Stored in directory: c:\users\mahmoud talaat\appdata\local\pip\cache\wheels\aa\5a\92\d52f6f8560ff05a2525e6030a1903412df876714241fb76802
Building wheel for audioread (setup.py) ... done
Created wheel for audioread: filename=audioread-2.1.8-py3-none-any.whl size=23095 sha256=496ad709e1fdf23b9961dde6afd84d92f5375a680098149e723f0becb8a882bf
Stored in directory: c:\users\mahmoud talaat\appdata\local\pip\cache\wheels\9b\94\80\3673f65684ab97e08999d1460fc1b238df7701805c739791cd
Building wheel for resampy (setup.py) ... done
Created wheel for resampy: filename=resampy-0.2.2-py3-none-any.whl size=320723 sha256=f45933a3f5337f6655f55abff77cc3c6ef9e66dce1dfc992cbaed221d832c2df
Stored in directory: c:\users\mahmoud talaat\appdata\local\pip\cache\wheels\6f\d1\5d\f13da53b1dcbc2624ff548456c9ffb526c914f53c12c318bb4
Successfully built librosa audioread resampy
Installing collected packages: audioread, resampy, soundfile, appdirs, pooch, librosa
Successfully installed appdirs-1.4.4 audioread-2.1.8 librosa-0.8.0 pooch-1.2.0 resampy-0.2.2 soundfile-0.10.3.post1
Nonetheless, I no longer get the AttributeError
! Thanks for the help!
I'm glad it worked.
There is no libsndfile
package for pip
. The libsndfile
library is installed automatically when you install the soundfile
module with pip
(either directly or via librosa
).
thank everyone above, I believe I have solved the problem.