Search code examples
python-3.xubuntuface-recognition

Python3 not recogninzing face_recognition as a module


I am trying to use the implement the face_recognition module, so far without success. When I try to run it with an import in python it just says that there is no such module, however when i just try to run face_recognition on it's own it works just fine.


Solution

  • Case 1: Same directory name

    Maybe your main folder name is face_recognition. If that's the case, then try to change it because if you try to import it, the python will import it from your main folder rather than importing it from the package folder.

    Case 2: Permission

    If you're using Linux, then make sure that the package folder is accessible. To verify that this the issue, try to run the program with elevated privileges using sudo command. You can try using the --user flag with pip (pip install face_recognition --user).

    Case 3: Environment variables

    It might be the case that your environment variables are not updated. May reference to the package folder is not present. That's why your python interpreter is unable to find the package. For path details:

    import sys
    print(sys.path)
    

    Using this, you will get an idea of whether your interpreter searches for the package or not.