face_recognition icon indicating copy to clipboard operation
face_recognition copied to clipboard

Can't run Face Recognition on Apple Silicon M1

Open MemoryAccessRegister opened this issue 3 years ago • 8 comments

  • face_recognition version: 1.3.0
  • Python version: 3.8.10
  • Operating System: macOS 12.1

Description

Can't run Face Recognition on Apple Silicon based Mac

What I Did

After installing face recognition using pip3 and running face_recognition I get the following error message

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/face_recognition", line 5, in <module>
    from face_recognition.face_recognition_cli import main
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/face_recognition/__init__.py", line 7, in <module>
    from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/face_recognition/api.py", line 4, in <module>
    import dlib
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dlib/__init__.py", line 19, in <module>
    from _dlib_pybind11 import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/_dlib_pybind11.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '_png_do_expand_palette_rgb8_neon'

MemoryAccessRegister avatar Feb 18 '22 23:02 MemoryAccessRegister

I am having same issue, have you found any work around ? @MemoryAccessRegister

haideratGitHub avatar Feb 24 '22 19:02 haideratGitHub

Same here!

jolo-dev avatar Mar 01 '22 06:03 jolo-dev

I am also getting the same error: symbol not found in flat namespace '_png_do_expand_palette_rgb8_neon' The error occurs in spite of the dlib package being installed for the relevant Python version.

I am using VSCode, in case that is relevant.

Can anyone please help me to fix this bug?

Dhruvdd avatar Mar 05 '22 05:03 Dhruvdd

same here, getting the same issue has anyone solved it yet?

nimo-codes avatar Jun 09 '22 11:06 nimo-codes

The issue is not with the apple m1, but in puthon some libraries overlap so thats why jt is fiving that error. For it you can use conda and inside that make virtual env and then download all the libraries need for you project. It worked well with me.

Dhruvdd avatar Jun 09 '22 14:06 Dhruvdd

after trying everything with python 3.8 I have managed by using python 3.6 with pip install cmake dlib

ysiegel29 avatar Jun 25 '22 21:06 ysiegel29

The issue is not with the apple m1, but in puthon some libraries overlap so thats why jt is fiving that error. For it you can use conda and inside that make virtual env and then download all the libraries need for you project. It worked well with me.

This method did not work for me, I tried setting up a Conda environment with Python 3.10.4. It is showing me the same error.

M4Marvin avatar Aug 15 '22 17:08 M4Marvin

@M4Marvin try installing python 3.8, then it will work fine, you just have to degrade the python version because of which you are getting error.

Dhruvdd avatar Aug 16 '22 06:08 Dhruvdd

I got the solution for this, this works for me

First: pip uninstall dlib pip uninstall face-recognition

After uninstalling, refer to this website to install dlib step-by-step: https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf

After dlib is installed, you can now directly install face-recognition through the command line pip install face-recognition

Refer to this website for more detail: https://face-recognition.readthedocs.io/en/latest/readme.html#installing-on-mac-or-linux

My Device: MacBook Air M1(8GB+256GB)

Let me know if I helped you to resolve this error.

bhupendrak9917 avatar Feb 09 '23 07:02 bhupendrak9917