【发布时间】:2020-11-14 22:47:33
【问题描述】:
我正在使用 python 中的一个 azure 函数,它使用 librosa 来可视化一些音频数据。它在我的 vscode 的 windows 框中本地运行良好。从命令行远程构建
func azure functionapp publish functionappname --build remote
成功,但是当客户端向其发布数据时,它会失败
OSError: sndfile library not found
File "/home/site/wwwroot/VisualizeDemo/__init__.py", line 20, in <module> import librosa
File "/home/site/wwwroot/.python_packages/lib/site-packages/librosa/__init__.py", line 12, in <module> from . import core
File "/home/site/wwwroot/.python_packages/lib/site-packages/librosa/core/__init__.py", line 126, in <module> from .audio import * # pylint: disable=wildcard-import
File "/home/site/wwwroot/.python_packages/lib/site-packages/librosa/core/audio.py", line 10, in <module> import soundfile as sf
File "/home/site/wwwroot/.python_packages/lib/site-packages/soundfile.py", line 142, in <module> raise OSError('sndfile library not found')
我了解 librosa 依赖于 libsndfile,并且
pip install librosa
还在我的本地安装 libsndfile,并且该 libsndfile 不包含在我上传到 azure 的轮子中。我跑了
apt-get install libsndfile1
在函数主机上,将库安装在那里,似乎已经成功:
root@7d0b717a5bb5:/home/site/wwwroot# apt-get install libsndfile1
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsndfile1 is already the newest version (1.0.28-6).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
但是函数还是找不到。是否有不同的方法来安装 libsndfile 以便函数可以看到它,或者告诉函数在哪里寻找该库?函数应用在常规应用服务计划上运行,而不是无服务器消费计划。
【问题讨论】:
标签: python azure librosa libsndfile