I am deploying a docker containerised Application on Google cloud run and facing the issue

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

The docker files is as follow

#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

and following is the 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

How can I resolve the issue any clue. I have tried the solutions provided on the link but it did not worked in my case

1

There are 1 answers

0
Ben K On

Your base image doesn't have a C++ compiler so it can't build the native libraries for that package. You can either install gcc yourself or use the non-slim base image which I think has it already installed