gpt4 book ai didi

amazon-web-services - 由于不可用,无法使用 Amazon EC2 实例安装 Sndfile

转载 作者:行者123 更新时间:2023-12-04 17:13:15 26 4
gpt4 key购买 nike

我正在尝试部署一个使用 TensorFlow 和 Librosa 的 flask 应用程序。因此,作为 Librosa 的依赖项,我需要 sndfile 包。

当我运行我的 Flask 应用程序时,出现此错误:

import librosa
File "/home/ec2-user/.local/lib/

python3.7/site-packages/librosa/__init__.py", line 211, in <module>
from . import core
File "/home/ec2-user/.local/lib/python3.7/site-packages/librosa/core/__init__.py", line 6, in <module>
from .audio import * # pylint: disable=wildcard-import
File "/home/ec2-user/.local/lib/python3.7/site-packages/librosa/core/audio.py", line 8, in <module>
import soundfile as sf
File "/home/ec2-user/.local/lib/python3.7/site-packages/soundfile.py", line 142, in <module>
raise OSError('sndfile library not found')
OSError: sndfile library not found
[ec2-user@ip-172-31-90-51 CE_Ayush_Deployment]$ python3 app.py
Traceback (most recent call last):
File "app.py", line 2, in <module>
from model_pipeline import Corona_Diagnoser
File "/home/ec2-user/CE_Ayush_Deployment/model_pipeline.py", line 5, in <module>
import librosa
File "/home/ec2-user/.local/lib/python3.7/site-packages/librosa/__init__.py", line 211, in <module>
from . import core
File "/home/ec2-user/.local/lib/python3.7/site-packages/librosa/core/__init__.py", line 6, in <module>
from .audio import * # pylint: disable=wildcard-import
File "/home/ec2-user/.local/lib/python3.7/site-packages/librosa/core/audio.py", line 8, in <module>
import soundfile as sf
File "/home/ec2-user/.local/lib/python3.7/site-packages/soundfile.py", line 142, in <module>
raise OSError('sndfile library not found')
OSError: sndfile library not found

我试过:

sudo yum install autoconf autogen automake build-essential libasound2-dev \
libflac-dev libogg-dev libtool libvorbis-dev libopus-dev libmp3lame-dev \
libmpg123-dev pkg-config python

然后我收到这条消息:

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
No package build-essential available.
No package libasound2-dev available.
No package libflac-dev available.
No package libogg-dev available.
No package libvorbis-dev available.
No package libopus-dev available.
No package libmp3lame-dev available.
No package libmpg123-dev available.
No package pkg-config available.

我知道该包在 Amazon EC2 实例中不可用。谁能指导我如何将 sndfile 包安装到系统中?

最佳答案

亚马逊 Linux 2

我在 Amazon Linux 2 ,您可以通过在 EC2 服务器上运行以下命令来验证。

[ec2-user@fake-ip ~]$ cat /etc/system-release
Amazon Linux release 2 (Karoo)

以下软件包可从 Amazon package repository 获得: libsndfile-devel, libsndfile-utils, libsndfile.

 [ec2-user@fakeip ~]$ yum search libsndfile
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
=============================================== N/S matched: libsndfile ================================================
libsndfile-devel.x86_64 : Development files for libsndfile
libsndfile-utils.x86_64 : Command Line Utilities for libsndfile
libsndfile.x86_64 : Library for reading and writing sound files
libsndfile.i686 : Library for reading and writing sound files

亚马逊Linux AMI

根据 Amazon Linux AMI package list ,这个早期版本的 Amazon Linux 没有 libsndfile。尽管您可以启用 Extra Packages for Enterprise Linux (EPEL),但 libsndfile 似乎也不存在。

[ec2-user@fakeip ~]$ cat /etc/system-release
Amazon Linux AMI release 2018.03
[ec2-user@fakeip ~]$ sudo yum-config-manager --enable epel
... skipping lots of output
mirrorlist = https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64
...
[ec2-user@fakeip ~]$ yum search libsndfile
Loaded plugins: priorities, update-motd, upgrade-helper
epel/x86_64/metalink | 3.8 kB 00:00:00
epel | 4.7 kB 00:00:00
(1/3): epel/x86_64/group_gz | 74 kB 00:00:00
(2/3): epel/x86_64/updateinfo | 788 kB 00:00:00
(3/3): epel/x86_64/primary_db | 6.1 MB 00:00:00
1067 packages excluded due to repository priority protections
Warning: No matches found for: libsndfile
No matches found

libsndfile docs声明它已在 Debian/GNU Linux 上编译,但 Amazon Linux AMI 并非基于 Debian。 libsndfile 的构建依赖项(autoconf autogen automake build-essential libasound2-dev libflac-dev libogg-dev libtool libvorbis-dev libopus-dev libmp3lame-dev libmpg123-dev pkg-config python)都是指 Debian 软件包,其他 Linux 版本的名称不同。特别是,build-essentiallibasound2-devlibflac-devlibopus-dev libmp3lame-devlibmpg123-dev 不在 EPEL 上。

[ec2-user@fakeip ~]$ yum search autoconf autogen automake build-essential \
libasound2-dev libflac-dev libogg-dev libtool libvorbis-dev libopus-dev \
libmp3lame-dev libmpg123-dev pkg-config python
... skipping output
Warning: No matches found for: build-essential
Warning: No matches found for: libasound2-dev
Warning: No matches found for: libflac-dev
Warning: No matches found for: libopus-dev
Warning: No matches found for: libmp3lame-dev
Warning: No matches found for: libmpg123-dev

libmpelame-dev 可能是 lame-devellame-libslame 和/或 lame-mp3x.

[ec2-user@fakeip ~]$ yum search lame
Loaded plugins: priorities, update-motd, upgrade-helper
1067 packages excluded due to repository priority protections
================================================== N/S matched: lame ===================================================
lame-devel.i686 : Development files for lame
lame-devel.x86_64 : Development files for lame
lame-libs.i686 : LAME MP3 encoding library
lame-libs.x86_64 : LAME MP3 encoding library
flamerobin.x86_64 : Graphical client for Firebird
lame.x86_64 : Free MP3 audio compressor
lame-mp3x.x86_64 : MP3 frame analyzer

libflac-dev 可能是 flac-devel

[ec2-user@fakeip ~]$ yum search flac
Loaded plugins: priorities, update-motd, upgrade-helper
1067 packages excluded due to repository priority protections
================================================== N/S matched: flac ===================================================
flac-devel.x86_64 : Development libraries and header files from FLAC
easytag.x86_64 : Tag editor for mp3, ogg, flac and other music files
flac.i686 : An encoder/decoder for the Free Lossless Audio Codec
flac.x86_64 : An encoder/decoder for the Free Lossless Audio Codec
mp3fs.x86_64 : FUSE filesystem to transcode FLAC to MP3 on the fly

libopus-dev 可能是 opus-devel

[ec2-user@fakeip ~]$ yum search opus
Loaded plugins: priorities, update-motd, upgrade-helper
1067 packages excluded due to repository priority protections
================================================== N/S matched: opus ===================================================
opus-devel.i686 : Development package for opus
opus-devel.x86_64 : Development package for opus
opus.i686 : An audio codec for use in low-delay speech and audio communication
opus.x86_64 : An audio codec for use in low-delay speech and audio communication

libmpg123-devhttps://www.mpg123.org/

建议

  • 将您的 EC2 切换到 Amazon Linux 2 或 Ubuntu
  • 在 EC2 上的 Docker 镜像中运行您的应用

关于amazon-web-services - 由于不可用,无法使用 Amazon EC2 实例安装 Sndfile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69099123/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com