Reputation: 3
I am tryin to install face-recognition module using the standard method but getting stuck at the dlib dependency
There are two parts of the Question first is ofcourse how to Fix this secondly is there a better alternative to get started with face recognition then this ( I come from a programing background but Python is new to me)
Env Details
# pip3 install face-recognition
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 /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages (from face-recognition) (1.26.4)
Collecting Pillow (from face-recognition)
Using cached pillow-10.3.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (9.2 kB)
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)
Using cached pillow-10.3.0-cp312-cp312-macosx_11_0_arm64.whl (3.4 MB)
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
╰─> [13 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
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/bin/cmake", line 5, in <module>
from cmake import cmake
ModuleNotFoundError: No module named 'cmake'
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
#
Tried installing dlib independently but run into the same cmake issue
Upvotes: 0
Views: 58
Reputation: 5744
The error ModuleNotFoundError: No module named 'cmake'
indicates that the Python interpreter cannot find a module named cmake
.
so most likely, the solution is this:
python -m pip install cmake
Alternatively, you are running it from an incorrect path or similar (maybe a virtual environment if you use one)...
Also, here is a link to the cmake docs: https://pypi.org/project/cmake
In answer to the second question, there are plenty of resources. Here is a book on Python coding which looks at the OpenCV
module with good examples:
python programming top of the stack
Upvotes: 0