pythonpython-3.xopencvface-recognition

AttributeError: partially initialized module 'face_recognition' has no attribute 'face_encodings'


I am trying to make face recognition script in python with the help of below given link found on google. https://www.mygreatlearning.com/blog/face-recognition/

I have installed:

libraries.

Also, installed Visual C++ for CMake.

And now I am trying to "extract features from Face" using code given in above link.

While running script, I am getting below error:

Traceback (most recent call last):
  File "C:\Users\ajay.arora2\AppData\Local\Programs\Python\Python38-32\extract_features_from_face.py", line 2, in <module>
    import face_recognition
  File "C:\Users\ajay.arora2\AppData\Local\Programs\Python\Python38-32\face_recognition.py", line 32, in <module>
    encodings = face_recognition.face_encodings(rgb)
AttributeError: partially initialized module 'face_recognition' has no attribute 'face_encodings' (most likely due to a circular import)

I have tried re-installing face_recognition module.

Please suggest any workaround. Thanks in advance.


Solution

  • Most probably you have named your file the same as the library "face_recognition".

    Circular import happens when you want to import something from the same file.