简体   繁体   English

在 Z1A79417461C9ADBE88F8B93E7FAD39 上部署音频预测 model 时出现“OSError: sndfile library not found”和“Unable to locate package libsndfile1”错误

[英]I am getting “OSError: sndfile library not found” & “Unable to locate package libsndfile1” errors when deploying audio prediction model on Heroku

The objective is to deploy an audio prediction ML model on Heroku, which uses librosa library from python.目标是在 Heroku 上部署音频预测 ML model,它使用来自 python 的 librosa 库。

The app.py file uses librosa library to extract features from the audio. app.py 文件使用 librosa 库从音频中提取特征。

When I try to deploy on Heroku, I get an error as shown below.当我尝试在 Heroku 上部署时,出现如下所示的错误。

2020-06-12T03:27:43.099874+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/librosa/core/audio.py", line 10, in <module>
2020-06-12T03:27:43.099875+00:00 app[web.1]:     import soundfile as sf
2020-06-12T03:27:43.099875+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/soundfile.py", line 142, in <module>
2020-06-12T03:27:43.099876+00:00 app[web.1]:     raise OSError('sndfile library not found')
2020-06-12T03:27:43.099876+00:00 app[web.1]: OSError: sndfile library not found
2020-06-12T03:27:43.101008+00:00 app[web.1]: [2020-06-12 03:27:43 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-06-12T03:27:43.255623+00:00 app[web.1]: [2020-06-12 03:27:43 +0000] [4] [INFO] Shutting down: Master
2020-06-12T03:27:43.255725+00:00 app[web.1]: [2020-06-12 03:27:43 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-06-12T03:27:43.333827+00:00 heroku[web.1]: Process exited with status 3
2020-06-12T03:27:43.371190+00:00 heroku[web.1]: State changed from starting to crashed

Here is a snapshot of my buildpacks that I am using to install the dependencies: Build pack list这是我用来安装依赖项的构建包的快照:构建包列表

Below is the list of dependencies mentioned in requirements.txt:下面是 requirements.txt 中提到的依赖项列表:

Flask==1.1.1
gunicorn==19.9.0
itsdangerous==1.1.0
Jinja2==2.10.1
MarkupSafe==1.1.1
Werkzeug==0.15.5
numpy>=1.9.2
scipy>=0.15.1
scikit-learn>=0.18
matplotlib>=1.4.3
pandas>=0.19
librosa==0.7.2
aniso8601==8.0.0
audioread==2.1.5

I have also created an Aptfile to install libsndfile1.我还创建了一个 Aptfile 来安装 libsndfile1。 I have linked a build-pack on Heroku to install from this Aptfile.我已经在 Heroku 上链接了一个构建包,以便从此 Aptfile 安装。 Below is the list mentioned in my Aptfile:以下是我的 Aptfile 中提到的列表:

libsndfile1
libsndfile-dev
libasound2-dev 
python-dev 
python-numpy 
python-setuptools 

Here is the image of error "Unable to locate package libsndfile1" while deploying on Heroku这是在 Heroku 上部署时出现错误“无法找到 package libsndfile1”的图像

How to overcome the "OSError: sndfile library not found" and "Unable to locate package libsndfile1" errors?如何克服“OSError: sndfile library not found”和“Unable to locate package libsndfile1”错误?

I have uploaded all the files to GitHub here for more information.我已将所有文件上传到 GitHub此处以获取更多信息。


Update (12/14/2020) : I changed my Aptfile and requirements.txt contents, and it worked.更新(2020 年 12 月 14 日) :我更改了我的 Aptfile 和 requirements.txt 内容,它起作用了。

Here are the contents of Aptfile:以下是 Aptfile 的内容:

libsndfile1
libsndfile-dev
ffmpeg

Here are the contents of Aptfile:以下是 Aptfile 的内容:

aniso8601==8.0.0
audioread==2.1.8
certifi==2019.11.28
cffi==1.14.0
Click==7.0
decorator==4.4.2
ffmpeg-python==0.2.0
Flask==1.1.1
Flask-RESTful==0.3.8
future==0.18.2
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.11.1
joblib==0.14.1
librosa==0.7.2
llvmlite==0.31.0
MarkupSafe==1.1.1
marshmallow==3.2.2
numba==0.48.0
numpy==1.18.1
pycparser==2.20
pydub==0.23.1
pytz==2019.3
resampy==0.2.2
scikit-learn==0.22.2.post1
scipy==1.4.1
six==1.14.0
SoundFile==0.10.3.post1
Werkzeug==1.0.0
wincertstore==0.2
pandas==1.0.1
pathlib==1.0.1

You need to install sndfile as a package in your operating system.您需要在操作系统中将sndfile安装为 package。 This answer documents how to do that on Heroku. 此答案记录了如何在 Heroku 上执行此操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 azure 应用程序服务中部署时,librosa 中出现 OSError(&#39;sndfile library not found&#39;) - OSError('sndfile library not found') in librosa while deploying in azure app service Librosa 在 Docker 中引发 OSError('sndfile library not found') - Librosa raised OSError('sndfile library not found') in Docker Flask Heroku 部署的 Librosa 安装:“OSError: sndfile library not found”(H10 错误) - Librosa Installation for Flask Heroku Deployment: “OSError: sndfile library not found” (H10 error) 问题导入 python 声音文件库 - OSError: library not found: &#39;sndfile&#39; - Issue importing python soundfile library - OSError: library not found: 'sndfile' 在 heroku 上部署预测 model - Deploying prediction model on heroku 无法在 SageMaker Jupyter 笔记本实例“OSError:找不到 sndfile 库”上导入 librosa - Cannot import librosa on SageMaker Jupyter notebook instance "OSError: sndfile library not found" 在 Heroku 上部署 Streamlit Web 应用程序时出现 OSError - OSError when deploying streamlit web application on Heroku "为什么在使用 Heroku 部署 Django 时出现内部服务器错误(管理页面仍然有效)?" - Why am I getting an internal server error when deploying Django with Heroku (admin page still works)? 部署到heroku时终端中的错误 - Errors in terminal when deploying to heroku Python 在新安装的 Mac 上找不到 sndfile 库 - Python sndfile library not found on newly installed Mac
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM