Reputation: 19
I want to start face recognition project on python. i installed bython and install pipenv. after this when I install " pipenv install face_recognition" shell give me a error after some installation.
(mrblack--PGk31eo) C:\Users\mrblack>
pipenv install face_recognition
Installing face_recognition…
Error: An error occurred while installing face_recognition! Error text: Collecting face_recognition RuntimeError: CMake must be installed to build the following extensions:_dlib_pybind11 Installation Failed
Upvotes: 1
Views: 2106
Reputation: 11
I had the same error this worked for me:
You have to install make and dlib before installing face recognition.
pip3 install cmake
pip3 install dlib
pip3 install face-recognition
If this doesn't work you could use Visual Studio Code as idle.
Upvotes: 1
Reputation: 1163
I was getting the same error when I tried it. I resolved it by degrading to python3.7.
So follow these steps :
pip3 install CMake
pip3 install face-recognition
these steps will resolve the error but after that when I was using the library in my code it was again giving an error related to algorithmia. So I resolved it by downloading visual studio 2017
Hope it was helpful,
Thanks
Upvotes: 1
Reputation: 866
For installing face-recognition module for Ubuntu 18.04: (Try for other OS, I used this for 18.04)
Install cmake: pip install cmake
After cmake is successfully installed
Optional: Install git if you don't have git
git clone https://github.com/davisking/dlib.git
build the main dlib library
cd dlib mkdir build; cd build; cmake ..; cmake --build .
Build and install python essentials
cd .. python3 setup.py install
After all this run these to verify
python3
import dlib
Now install face_recognition
pip3 install face_recognition
Takes some time but that is okay! I hope it worked for you
Refer these materials:
face-recognition original repo: https://github.com/ageitgey/face_recognition#installing-on-mac-or-linux dlib: https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf
Upvotes: 2
Reputation: 1630
face_recognition package requires dlib and it is a very huge package and problematic in installation. I recommend you to adopt deepface package for face recognition. It is mainly based on Keras and TensorFlow. In other words, it is easy to make initial setup.
Besides, it wraps dlib and some other state-of-the-art face recognition models: VGG-Face (University of Oxford), FaceNet (Google), OpenFace (Carneige Mellon University), DeepFace (Facebook ) and DeepID (The Chienese University of Hong Kong). I recommend you to use VGG-Face or FaceNet models.
You should just pass image pairs as exact paths. BTW, you can pass base64 encoded images or direct numpy arrays as image pairs.
#!pip install deepface
from deepface import DeepFace
models = ['VGG-Face', 'Facenet', 'OpenFace', 'DeepFace', 'DeepID']
result = DeepFace.verify("img1.jpg", "img2.jpg", model_name = models[0])
print(result["verified"])
Result object stores the found distance and required distance threshold to verify an image pair.
Upvotes: 1
Reputation: 94397
From http://dlib.net/compile.html :
Note that you need to have CMake and a working C++ compiler installed for this to work.
(Emphasize mine — phd)
Install CMake from https://cmake.org/download/ or https://pypi.org/project/cmake/. Try pip install cmake
Upvotes: 2