face_recognition: ModuleNotFoundError: No module named 'face_recognition'

  • face_recognition version: 1.2.3
  • Python version: 3.7.4
  • Operating System: windows 10

Description

I have a problem with Run the file of facerec from webcam faster so I referenced #407 issue and I revised code like ‘import face_recognition’ to ‘from face_recognition_cli import face_recognition’


before I revised the code just like

import face_recognition

There was traceback message like this

PS C:\Users\puppy> & C:/Users/puppy/Anaconda3/python.exe c:/Tensorflow1/face/Untitled-1.py Traceback (most recent call last): File “c:/Tensorflow1/face/Untitled-1.py”, line 1, in <module> import face_recognition ModuleNotFoundError: No module named ‘face_recognition’

What I Did

and I ran, there was traceback message like this

PS C:\Users\puppy> & C:/Users/puppy/Anaconda3/python.exe c:/Tensorflow1/face/Untitled-1.py
Traceback (most recent call last):
  File "c:/Tensorflow1/face/Untitled-1.py", line 1, in <module>
    from face_recognition_cli import face_recognition
  File "c:\Tensorflow1\face\face_recognition_cli.py", line 6, in <module>
    import face_recognition.api as face_recognition
ModuleNotFoundError: No module named 'face_recognition'

what should I do??

About this issue

Most upvoted comments

Step1: pip install cmake Step2: pip install dlib Step3: pip install face_recognition it worked for me… But install it in specific environment that will be used later for face_recognition code.

if you have already installed dlib and face_recognition, 1st uninstall them by pip uninstall. then make sure you have cmake installed. you can do that by cmake –version if not install cmake. after that install dlib by conda. this way it will make sure you have all the dependencies installed. conda install -c conda-forge dlib then install face_recognition again by pip install face_recognition

this will solve the issue. (worked for me )

Hi Alamnoor,

I installed all the three which you have mentioned but I am getting error no module named ‘face_recognition’.

Please help.

Have you installed it in environment from where you are running your code? Mean: Step 1: Open " anaconda navigator" Step 2: Go to Environments and select required environment where you have installed face_recognition library i,e ( base (root), or you have another environments). Or you can create environment and then install this package there). Step 3: Open “idle”, or Jupyter notebook", or python shell from the current environment. Then check it. Thanks You can feel free to contact me again. Thanks