I have been trying to import the face_recognition module but it keeps giving me errors while building dependencies. I’ve installed CMake but I’m not able to install dlib for some reason. It keeps showing the following error:
Collecting face_recognition
Using cached face_recognition-1.3.0-py2.py3-none-any.whl.metadata (21 kB)
Collecting face-recognition-models>=0.3.0 (from face_recognition)
Using cached face_recognition_models-0.3.0-py2.py3-none-any.whl
Collecting Click>=6.0 (from face_recognition)
Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting dlib>=19.7 (from face_recognition)
Using cached dlib-19.24.4.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in c:python312libsite-packages (from face_recognition) (1.26.4)
Requirement already satisfied: Pillow in c:python312libsite-packages (from face_recognition) (10.3.0)
Requirement already satisfied: colorama in c:python312libsite-packages (from Click>=6.0->face_recognition) (0.4.6)
Using cached face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
Using cached click-8.1.7-py3-none-any.whl (97 kB)
Building wheels for collected packages: dlib
Building wheel for dlib (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for dlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
<string>:210: SyntaxWarning: invalid escape sequence '('
<string>:211: SyntaxWarning: invalid escape sequence '('
<string>:212: SyntaxWarning: invalid escape sequence '('
running bdist_wheel
running build
running build_ext
ERROR: CMake must be installed to build dlib
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dlib
Failed to build dlib
ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects
I have tried most of the solutions I’ve found here but nothing worked so far. I’ve tried changing environment variables, installing CMake from the website instead of with pip, downloading the .whl file into my project folder and executing it.
The last method gave me this error:
ERROR: dlib-19.24.1-cp311-cp311-win_amd64.whl is not a supported wheel on this platform.
Can anyone help me with a solution?
xnash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.