[英]Error importing librosa for TensorFlow: sndfile library not found
I'm trying to use TensorFlow Lite for a voice recognition project using Jupyter notebook but when I try to do a "import librosa" (using commands found here: https://github.com/ShawnHymel/tflite-speech-recognition/blob/master/01-speech-commands-mfcc-extraction.ipynb ) I keep getting this error:我正在尝试使用 TensorFlow Lite 进行使用 Jupyter 笔记本的语音识别项目,但是当我尝试执行“导入 librosa”时(使用此处找到的命令: https://github.com/ShawnHymel/tflite-speech-recognition/blob /master/01-speech-commands-mfcc-extraction.ipynb )我不断收到此错误:
OSError: sndfile library not found
I've looked for a solution for two days now, tried many different things I've found online but I just can't seem to get it to work.我已经寻找了两天的解决方案,尝试了我在网上找到的许多不同的东西,但我似乎无法让它工作。
I'm using CentOS 8 and the tensorflow is running on a docker:我正在使用 CentOS 8 和 tensorflow 在 docker 上运行:
docker pull tensorflow/tensorflow:latest-py3-jupyter
docker run -it --rm -v /home/server/Desktop/TensorFlow -p 8888:8888 tensorflow/tensorflow:latest-py3-jupyter
My requirements.txt is empty, at least when I do pip freeze > requirements.txt .我的 requirements.txt 是空的,至少在我执行pip freeze > requirements.txt时是这样。
pip -V or --v returns this pip -V 或 --v 返回此
pip 20.3.2 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
Trying to install pysndfile gives me this尝试安装 pysndfile 给了我这个
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-w_gdqebo/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools 'numpy>=1.13.0' 'cython>=0.25.0' wheel Check the logs for full command output.
I've tried different commands to fix this error and to install the sndfile but all of them have given errors or simply said it's already installed.我尝试了不同的命令来修复此错误并安装 sndfile,但它们都给出了错误或只是说它已经安装。
I do have librosa installed but trying to import it gives me this full error:我确实安装了 librosa,但尝试导入它给了我这个完整的错误:
OSError Traceback (most recent call last)
<ipython-input-10-989066361697> in <module>
----> 1 import librosa
/usr/local/lib/python3.6/dist-packages/librosa/__init__.py in <module>
209 # And all the librosa sub-modules
210 from ._cache import cache
--> 211 from . import core
212 from . import beat
213 from . import decompose
/usr/local/lib/python3.6/dist-packages/librosa/core/__init__.py in <module>
4
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
/usr/local/lib/python3.6/dist-packages/librosa/core/audio.py in <module>
6 import warnings
7
----> 8 import soundfile as sf
9 import audioread
10 import numpy as np
/usr/local/lib/python3.6/dist-packages/soundfile.py in <module>
140 _libname = _find_library('sndfile')
141 if _libname is None:
--> 142 raise OSError('sndfile library not found')
143 _snd = _ffi.dlopen(_libname)
144 except OSError:
OSError: sndfile library not found
Anyone got ideas on how to sort this?有人对如何排序有想法吗?
Install sndfile for your operating system.为您的操作系统安装 sndfile。 On CentOS that should be
yum install libsndfile
.在 CentOS 上应该是
yum install libsndfile
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.