serengil / deepface

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
https://bit.ly/deepface-py
MIT License
14.86k stars 2.24k forks source link

[BUG]: cannot install deepface #1381

Closed yuzhiguo07 closed 2 weeks ago

yuzhiguo07 commented 3 weeks ago

Before You Report a Bug, Please Confirm You Have Done The Following...

DeepFace's version

0.0.94

Python version

3.11.3

Operating System

ubuntu 24

Dependencies

Traceback (most recent call last): File "/mnt/new/public/face/try_openface.py", line 1, in from deepface import DeepFace File "/mnt/new/public/face/deepface/deepface/DeepFace.py", line 14, in import pandas as pd File "/home/xiaozhi/anaconda3/lib/python3.11/site-packages/pandas/init.py", line 22, in from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/xiaozhi/anaconda3/lib/python3.11/site-packages/pandas/compat/init.py", line 18, in from pandas.compat.numpy import ( File "/home/xiaozhi/anaconda3/lib/python3.11/site-packages/pandas/compat/numpy/init.py", line 4, in from pandas.util.version import Version File "/home/xiaozhi/anaconda3/lib/python3.11/site-packages/pandas/util/init.py", line 2, in from pandas.util._decorators import ( # noqa:F401 File "/home/xiaozhi/anaconda3/lib/python3.11/site-packages/pandas/util/_decorators.py", line 14, in from pandas._libs.properties import cache_readonly File "/home/xiaozhi/anaconda3/lib/python3.11/site-packages/pandas/_libs/init.py", line 13, in from pandas._libs.interval import Interval File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

then I try another server, get a different error:

from deepface import DeepFace
2024-11-05 20:21:16.079722: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1730859676.095845 119478 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
E0000 00:00:1730859676.100789 119478 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-11-05 20:21:16.117445: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last): File "", line 1, in
File "/mnt/new/public/face/deepface/deepface/DeepFace.py", line 20, in
from deepface.modules import (
File "/mnt/new/public/face/deepface/deepface/modules/modeling.py", line 5, in from deepface.models.facial_recognition import ( File "/mnt/new/public/face/deepface/deepface/models/facial_recognition/VGGFace.py", line 9, in from deepface.modules import verification File "/mnt/new/public/face/deepface/deepface/modules/verification.py", line 9, in from deepface.modules import representation, detection, modeling File "/mnt/new/public/face/deepface/deepface/modules/representation.py", line 8, in from deepface.commons import image_utils File "/mnt/new/public/face/deepface/deepface/commons/image_utils.py", line 12, in import cv2 File "/home/xiaozhi/anaconda3/envs/cell/lib/python3.9/site-packages/cv2/init.py", line 181, in bootstrap() File "/home/xiaozhi/anaconda3/envs/cell/lib/python3.9/site-packages/cv2/init.py", line 153, in bootstrap native_module = importlib.import_module("cv2") File "/home/xiaozhi/anaconda3/envs/cell/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) AttributeError: _ARRAY_API not found Traceback (most recent call last): File "", line 1, in File "/mnt/new/public/face/deepface/deepface/DeepFace.py", line 20, in from deepface.modules import ( File "/mnt/new/public/face/deepface/deepface/modules/modeling.py", line 5, in from deepface.models.facial_recognition import ( File "/mnt/new/public/face/deepface/deepface/models/facial_recognition/VGGFace.py", line 9, in from deepface.modules import verification File "/mnt/new/public/face/deepface/deepface/modules/verification.py", line 9, in from deepface.modules import representation, detection, modeling File "/mnt/new/public/face/deepface/deepface/modules/representation.py", line 8, in from deepface.commons import image_utils File "/mnt/new/public/face/deepface/deepface/commons/image_utils.py", line 12, in import cv2 File "/home/xiaozhi/anaconda3/envs/cell/lib/python3.9/site-packages/cv2/init.py", line 181, in bootstrap() File "/home/xiaozhi/anaconda3/envs/cell/lib/python3.9/site-packages/cv2/init.py", line 153, in bootstrap native_module = importlib.import_module("cv2") File "/home/xiaozhi/anaconda3/envs/cell/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: numpy.core.multiarray failed to import

Reproducible example

from deepface import DeepFace

Relevant Log Output

No response

Expected Result

No response

What happened instead?

No response

Additional Info

No response

serengil commented 2 weeks ago

exception message is clear: ImportError: numpy.core.multiarray failed to import it is not related to deepface. Your environment has problematic for numpy.