【发布时间】:2019-11-20 07:36:18
【问题描述】:
我在 Windows 10 Pro 机器上使用 Docker(Linux 容器)。我创建了一个 docker 容器来运行我的烧瓶应用程序,并在 requirements.txt 文件中提到了所需的库。
当我运行 docker 容器时,我收到以下消息
OSError: ctypes.util.find_library() 未能找到名为“sndfile”的库。
如何在 Docker 中安装 sndfile 库?
参考链接:https://pysoundfile.readthedocs.io/en/0.9.0/ 我尝试在 Dockerfile 中使用以下命令安装 libsndfile
---- RUN apt-get install libsndfile1
Got Below message from docker build:
Step 5/7 : RUN apt-get install libsndfile1
---> Running in <container>
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libsndfile1
The command '/bin/sh -c apt-get install libsndfile1' returned a non-zero code: 100
1.Docker 版本:
Client:
Version: 17.03.1-ce-rc1
API version: 1.27
Go version: go1.7.5
Git commit: 3476dbf
Built: Wed Mar 15 20:33:22 2017
OS/Arch: windows/amd64
Server:
Version: 17.03.1-ce-rc1
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: 3476dbf
Built: Wed Mar 15 20:28:18 2017
OS/Arch: linux/amd64
Experimental: true
2.requirements.txt 文件
flask
tensorflow-gpu
flask_cors
uuid
librosa
pysoundfile
numpy
cffi
requests
wave
h5py
pydub
werkzeug
完整的错误信息:
File "app.py", line 5, in <module>
import librosa
File "/usr/local/lib/python3.7/site-packages/librosa/__init__.py", line 13, in <module>
from . import core
File "/usr/local/lib/python3.7/site-packages/librosa/core/__init__.py", line 115, in <module>
from .audio import * # pylint: disable=wildcard-import
File "/usr/local/lib/python3.7/site-packages/librosa/core/audio.py", line 8, in <module>
import soundfile as sf
File "/usr/local/lib/python3.7/site-packages/soundfile.py", line 267, in <module>
_snd = _ffi.dlopen('sndfile')
File "/usr/local/lib/python3.7/site-packages/cffi/api.py", line 146, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "/usr/local/lib/python3.7/site-packages/cffi/api.py", line 828, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "/usr/local/lib/python3.7/site-packages/cffi/api.py", line 823, in _load_backend_lib
raise OSError(msg)
OSError: ctypes.util.find_library() did not manage to locate a library called 'sndfile'
【问题讨论】:
-
你的 Dockerfile
RUN apt-get update吗?你通常应该在一个命令中RUN apt-get update && apt-get install ...。
标签: docker libsndfile