HyperInspire / InspireFace

InspireFace is a cross-platform face recognition SDK developed in C/C++, supporting multiple operating systems and various backend types for inference, such as CPU, GPU, and NPU.
26 stars 7 forks source link

ImportError: Could not load libInspireFace.so. #62

Open 0714lxy0714 opened 1 month ago

0714lxy0714 commented 1 month ago

Hello, I would like to ask about an environment configuration issue. While testing on Ubuntu and following the given environment configuration requirements, I configured the environment twice. During the debugging process, the same error occurred. What could be the problem? (InspireFace) l@l-ThinkStation-P920:/media/l/56c1a6af-6c26-4b19-8667-59642efbd717/InspireFace/python$ python Python 3.8.19 (default, Mar 20 2024, 19:58:24) [GCC 11.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information.

import os import cv2 import inspireface as ifac Traceback (most recent call last): File "", line 1, in File "/media/l/56c1a6af-6c26-4b19-8667-59642efbd717/InspireFace/python/inspireface/init.py", line 1, in from .modules import File "/media/l/56c1a6af-6c26-4b19-8667-59642efbd717/InspireFace/python/inspireface/modules/init.py", line 1, in from .inspire_face import ImageStream, FaceExtended, FaceInformation, SessionCustomParameter, InspireFaceSession, \ File "/media/l/56c1a6af-6c26-4b19-8667-59642efbd717/InspireFace/python/inspireface/modules/inspire_face.py", line 3, in from .core import File "/media/l/56c1a6af-6c26-4b19-8667-59642efbd717/InspireFace/python/inspireface/modules/core/init.py", line 1, in from .native import * File "/media/l/56c1a6af-6c26-4b19-8667-59642efbd717/InspireFace/python/inspireface/modules/core/native.py", line 870, in _libs[_LIBRARY_FILENAME] = load_library(_LIBRARY_FILENAME) File "/media/l/56c1a6af-6c26-4b19-8667-59642efbd717/InspireFace/python/inspireface/modules/core/native.py", line 558, in call raise ImportError("Could not load %s." % libname) ImportError: Could not load libInspireFace.so.

0714lxy0714 commented 1 month ago
mmexport1717334303736
tunmx commented 3 days ago

Hello, the reasons for the .so file failing to load successfully are:

  1. You must copy or create a symlink for the compiled insightface.so file and place it in the python/inspireface/modules/core/ directory to ensure that the code can access it..
  2. If you are using an Anaconda virtual environment, there might be a conflict between the version of libstdc++ that the environment relies on and the version required by inspireface.so. Usually, upgrading or replacing the version of libstdc++ can resolve this issue.
  3. Your computer might be missing some libraries that OpenCV depends on.

In the new version(https://github.com/deepinsight/insightface/pull/2607), we have added error messages for when the inspireface.so library fails to load. You can find these messages in the console and follow the prompts to resolve the issues, for example:

python sample_face_detection.py ../test_res/pack/Pikachu ../test_res/data/bulk/face_sample.png
/home/tunm/work/InspireFace/python/inspireface/modules/core/liblibInspireFace.so.so: cannot open shared object file: No such file or directory
/home/tunm/work/InspireFace/python/inspireface/modules/core/libInspireFace.so.so: cannot open shared object file: No such file or directory
/lib/x86_64-linux-gnu/libgtk-3.so.0: undefined symbol: g_mount_operation_set_is_tcrypt_hidden_volume
.....

Additionally, we used GitHub Actions in the development repository to deploy and test Python calls to native code, and it ran successfully. You can refer to the script for details: CI Script