python - 面对这个错误文件构建docker image dlib

标签 python docker flask face-recognition dlib

ERROR: Command errored out with exit status 1: command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-oho_tlt5/dlib/setup.py'"'"'; file='"'"'/tmp/pip-install-oho_tlt5/dlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-vktrpqpq cwd: /tmp/pip-install-oho_tlt5/dlib/ Complete output (53 lines): running bdist_wheel running build running build_py package init file 'dlib/init.py' not found (or not a regular file) running build_ext Traceback (most recent call last): File "/tmp/pip-install-oho_tlt5/dlib/setup.py", line 120, in get_cmake_version out = subprocess.check_output(['cmake', '--version']) File "/usr/local/lib/python3.8/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/local/lib/python3.8/subprocess.py", line 489, in run with Popen(*popenargs, **kwargs) as process: File "/usr/local/lib/python3.8/subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'cmake'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-oho_tlt5/dlib/setup.py", line 223, in setup( File "/usr/local/lib/python3.8/site-packages/setuptools/init.py", line 144, in setup return distutils.core.setup(attrs) File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 223, in run self.run_command('build') File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.8/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/tmp/pip-install-oho_tlt5/dlib/setup.py", line 129, in run cmake_version = self.get_cmake_version() File "/tmp/pip-install-oho_tlt5/dlib/setup.py", line 122, in get_cmake_version raise RuntimeError("\n*****************************************************************\n" + RuntimeError: ******************************************************************* CMake must be installed to build the following extensions: dlib *******************************************************************


ERROR: Failed building wheel for dlib


DOCKERFILE

FROM python:3

WORKDIR ./app

COPY ./requirements.txt .

RUN pip install --upgrade pip \
        && apt-get install -y --fix-missing\
        && pip install --no-cache-dir -r requirements.txt

COPY . ./app

ENTRYPOINT [ "python", "./app.py" ]

最佳答案

在你的 Dockerfile 中。

FROM python:3
WORKDIR ./app
COPY ./requirements.txt .
RUN pip install -U pip wheel cmake
RUN pip install -r requirements.txt
COPY . ./app
ENTRYPOINT [ "python", "./app.py" ]

首先使用pip安装cmakewheel,您从requirement.txt文件安装的软件包会先下载然后安装,用于这就是它无法安装dlib的原因。

关于python - 面对这个错误文件构建docker image dlib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60544404/

相关文章:

python - 点击动态按钮不起作用(python)

python - Matplotlib 根据 x 的范围不同的颜色点

docker - Kubernetes 中的容器标签

python - 是否可以从正在运行的 Docker 容器中发送 HTTP 请求

python - 如何从多个矩阵列表中创建矩阵?

apache - 如何管理安装到 docker 容器中的卷的权限?

ubuntu - Docker 守护进程标志被忽略

flask - Flask-Admin 中的自定义和可排序列

python - flask 应用程序通过 Uwsgi 和 Nginx 给出 504 超时?

python - 使用 UUIDField 作为主键时如何判断模型实例是否是新的