I am trying to deploy a Deepface model for my Smart attendance System
kenbaker-gif
HOBBYOP

2 months ago

builder

RUN python -c "from deepface import DeepFace; DeepFace.build_model('VGG-Face'); DeepFace.build_model('RetinaFace')"

3s

Traceback (most recent call last):

File "<string>", line 1, in <module>

File "/opt/conda/lib/python3.10/site-packages/deepface/DeepFace.py", line 21, in <module>

from deepface.modules import (

File "/opt/conda/lib/python3.10/site-packages/deepface/modules/modeling.py", line 7, in <module>

from deepface.models.facial_recognition import (

File "/opt/conda/lib/python3.10/site-packages/deepface/models/facial_recognition/VGGFace.py", line 9, in <module>

from deepface.modules import verification

File "/opt/conda/lib/python3.10/site-packages/deepface/modules/verification.py", line 10, in <module>

from deepface.modules import representation, detection, modeling

File "/opt/conda/lib/python3.10/site-packages/deepface/modules/representation.py", line 10, in <module>

from deepface.commons import image_utils

File "/opt/conda/lib/python3.10/site-packages/deepface/commons/image_utils.py", line 12, in <module>

import cv2

File "/opt/conda/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>

bootstrap()

File "/opt/conda/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap

native_module = importlib.import_module("cv2")

File "/opt/conda/lib/python3.10/importlib/__init__.py", line 126, in import_module

return bootstrap.gcd_import(name[level:], package, level)

ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.15' not found (required by /opt/conda/lib/python3.10/site-packages/cv2/python-3.10/cv2.cpython-310-x86_64-linux-gnu.so)

Build Failed: build daemon returned an error < failed to solve: process "/bin/sh -c python -c \"from deepface import DeepFace; DeepFace.build_model('VGG-Face'); DeepFace.build_model('RetinaFace')\"" did not complete successfully: exit code: 1 >

Solved$10 Bounty

Pinned Solution

ilyassbreth
FREE

2 months ago

this looks like a conda issue with libstdc++. here's what i think you should try:

the problem is conda's opencv has an old libstdc++ that doesn't have CXXABI_1.3.15. this is a common issue when deploying opencv in docker.

try switching from conda base to regular python and use opencv-headless via pip:

dockerfile

FROM python:3.10-slim

RUN apt-get update && apt-get install -y \
    libglib2.0-0 \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

RUN pip install deepface opencv-python-headless

RUN python -c "from deepface import DeepFace; DeepFace.build_model('VGG-Face'); DeepFace.build_model('RetinaFace')"

this should avoid the conda libstdc++ issue that's causing your build to fail. opencv-python-headless is specifically designed for servers/docker and doesn't have the gui dependencies that cause these problems

hope this help you slightly_smiling_face emoji

3 Replies

Status changed to Awaiting User Response Railway about 2 months ago


ilyassbreth
FREE

2 months ago

this looks like a conda issue with libstdc++. here's what i think you should try:

the problem is conda's opencv has an old libstdc++ that doesn't have CXXABI_1.3.15. this is a common issue when deploying opencv in docker.

try switching from conda base to regular python and use opencv-headless via pip:

dockerfile

FROM python:3.10-slim

RUN apt-get update && apt-get install -y \
    libglib2.0-0 \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

RUN pip install deepface opencv-python-headless

RUN python -c "from deepface import DeepFace; DeepFace.build_model('VGG-Face'); DeepFace.build_model('RetinaFace')"

this should avoid the conda libstdc++ issue that's causing your build to fail. opencv-python-headless is specifically designed for servers/docker and doesn't have the gui dependencies that cause these problems

hope this help you slightly_smiling_face emoji


kenbaker-gif
HOBBYOP

2 months ago

Actually it has worked thanks a lot


kenbaker-gif

Actually it has worked thanks a lot

ilyassbreth
FREE

2 months ago

awesome, glad it worked out for you. good luck with your smart attendance system hugs emoji


Status changed to Solved brody about 2 months ago


Loading...