gcc 在云上部署时,我遇到了一个错误:无法为pycocotools构建wheel,这是安装基于pyproject.tom l的项目所必需的

b09cbbtk  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(246)

我正在Google Cloud Run上部署一个Docker容器化应用程序,

Building wheels for collected packages: Secret-Manager, pycocotools, termcolor, treelib, coverage, xhtml2pdf, antlr4-python3-runtime, stringcase, future, svglib
Step #0:   Building wheel for Secret-Manager (setup.py): started
Step #0:   Building wheel for Secret-Manager (setup.py): finished with status 'done'
Step #0:   Created wheel for Secret-Manager: filename=Secret_Manager-1.0.0-py3-none-any.whl size=3207 sha256=a8fc3edbfbf7bc6c63a8b4743c4cdfcf4860e964082d11bf0ec07863ba840d6d
Step #0:   Stored in directory: /root/.cache/pip/wheels/6a/b1/83/6bb7443da6d0eddeb09108a425f97ae623048e1d579a65da35
Step #0:   Building wheel for pycocotools (pyproject.toml): started
Step #0:   Building wheel for pycocotools (pyproject.toml): finished with status 'error'
Step #0:   error: subprocess-exited-with-error
Step #0:   
Step #0:   × Building wheel for pycocotools (pyproject.toml) did not run successfully.
Step #0:   │ exit code: 1
Step #0:   ╰─> [21 lines of output]
Step #0:       running bdist_wheel
Step #0:       running build
Step #0:       running build_py
Step #0:       creating build
Step #0:       creating build/lib.linux-x86_64-cpython-310
Step #0:       creating build/lib.linux-x86_64-cpython-310/pycocotools
Step #0:       copying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-310/pycocotools
Step #0:       copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-310/pycocotools
Step #0:       copying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-310/pycocotools
Step #0:       copying pycocotools/__init__.py -> build/lib.linux-x86_64-cpython-310/pycocotools
Step #0:       running build_ext
Step #0:       /tmp/pip-build-env-orf1v9v9/overlay/lib/python3.10/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-yap6d6s2/pycocotools_ccc10746b8464ffc97ac525b5fe81013/pycocotools/_mask.pyx
Step #0:         tree = Parsing.p_module(s, pxd, full_module_name)
Step #0:       Compiling pycocotools/_mask.pyx because it changed.
Step #0:       [1/1] Cythonizing pycocotools/_mask.pyx
Step #0:       building 'pycocotools._mask' extension
Step #0:       creating build/temp.linux-x86_64-cpython-310
Step #0:       creating build/temp.linux-x86_64-cpython-310/common
Step #0:       creating build/temp.linux-x86_64-cpython-310/pycocotools
Step #0:       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/pip-build-env-orf1v9v9/overlay/lib/python3.10/site-packages/numpy/core/include -I./common -I/usr/local/include/python3.10 -c ./common/maskApi.c -o build/temp.linux-x86_64-cpython-310/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
Step #0:       error: command 'gcc' failed: No such file or directory
Step #0:       [end of output]
Step #0:   
Step #0:   note: This error originates from a subprocess, and is likely not a problem with pip.
Step #0:   ERROR: Failed building wheel for pycocotools

字符串
Docker文件如下

#his is an official Python runtime, used as the parent image
FROM python:3.8.10-slim

# set the working directory in the container to /app
WORKDIR /app

# add the current directory to the container as /app
ADD . /app

#execute everyone's favorite pip command, pip install -r

RUN pip3 install -r requirements.txt

# execute the Flask app
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app


下面是requirements.txt

boto3==1.17.15
botocore==1.20.15
ultralytics==8.0.207
super-gradients==3.3.1
numpy==1.23.0
matplotlib==3.5.3
opencv-python==4.6.0.66
scipy==1.10.0
markupsafe==2.0.1
gunicorn==19.9.0
google-cloud-firestore==2.5.2
google-cloud-core==2.3.2
google-cloud-pubsub
mlflow==2.8.0
google.cloud.storage==1.41.1
requests==2.28.2


我怎么能解决这个问题任何线索。我已经尝试了链接上提供的解决方案,但它没有在我的情况下工作

hi3rlvi2

hi3rlvi21#

你的基础镜像没有C++编译器,所以它不能为那个包构建原生库。你可以自己安装gcc,或者使用非slim基础镜像,我想它已经安装了

相关问题