1

I have been playing with facial recognition a little bit in python, but have been having trouble with getting dlib to work.

I am on a windows 10 environment, working inside of the Pycharm terminal using pip to install everything. When I try to install dlib inside of the terminal, I get a message stating it failed with error code 1.

Command "C:\Users\Jonathan\PycharmProjects\image_recognition\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Jonathan\\AppData\\Local\\Temp\\pip-install-87y4zmcs\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read() .replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Jonathan\AppData\Local\Temp\pip-record-ug95jqxj\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\Jonathan\PycharmProjects\image _recognition\venv\include\site\python3.7\dlib" failed with error code 1 in C:\Users\Jonathan\AppData\Local\Temp\pip-install-87y4zmcs\dlib\

So i opened up the dlib tar.zip file, extracted it, and ran the setup.py and copied the dlib folder inside of that into my site-packages folder.

After that when I try to use the python library face_recognition, I get this error from dlib- C:\Users\Jonathan\PycharmProjects\image_recognition\venv\Scripts\python.exe C:/Users/Jonathan/PycharmProjects/image_recognition/image_recognition.py Traceback (most recent call last): File "C:/Users/Jonathan/PycharmProjects/image_recognition/image_recognition.py", line 1, in <module> import face_recognition File "C:\Users\Jonathan\PycharmProjects\image_recognition\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 "C:\Users\Jonathan\PycharmProjects\image_recognition\face_recognition\api.py", line 17, in <module> face_detector = dlib.get_frontal_face_detector() AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector'

I have installed cmake within the terminal as well before I ran the face_recognition. Any help would be appreciated. I will be able to check this in about 15-20 minutes.

2 Answers2

0

Check this solution from below link, AttributeError: 'module' object has no attribute 'get_frontal_face_detector'.

And the face recognition module requires dlib version should be above 19.+.

I'd used 19.17 in my project and installed via conda environment,How can I solve Error of installation Dlib?)

MathanKumar
  • 543
  • 1
  • 4
  • 17
0

This solves my problem :

AttributeError: 'module' object has no attribute 'get_frontal_face_detector'

pip uninstall dlib

pip install dlib

Os:Macos

Jatin Bansal
  • 875
  • 12
  • 24