I am getting an error while importing the face_recognition library. I have tried using a Virtual Environment too. Please help.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python38\lib\site-packages\face_recognition-1.3.0-py3.8.egg\face_recognition\__init__.py", line 7, in <module>
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "C:\Program Files\Python38\lib\site-packages\face_recognition-1.3.0-py3.8.egg\face_recognition\api.py", line 17, in <module>
face_detector = dlib.get_frontal_face_detector()
AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector'
Version: Python 3.8
OS: Windows 10
You need to download the face database shape_predictor_68_face_landmarks, you need to download it and unzip it and put it in the folder where your code is located
Face Library Download Link:http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
Related
I have a project where I'll use the face_recognition library to recognise faces in Images. I tried the following code to make sure if the library is working:
from PIL import Image
import numpy as np
import face_recognition
obama_image = face_recognition.load_image_file("obama.jpg")
But I get the following error:
Traceback (most recent call last):
File "test.py", line 3, in <module>
import face_recognition
File "C:\Users\علي\AppData\Roaming\Python\Python38\site-packages\face_recognition\__init__.py", line 7, in <module>
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "C:\Users\علي\AppData\Roaming\Python\Python38\site-packages\face_recognition\api.py", line 20, in <module>
pose_predictor_68_point = dlib.shape_predictor(predictor_68_point_model)
RuntimeError: Unable to open C:\Users\علي\AppData\Roaming\Python\Python38\site-packages\face_recognition_models\models\shape_predictor_68_face_landmarks.dat
I tried some sulotions that I found but nothing worked.
I downloaded dlib library in the proper way.
I redownloaded the file shape_predictor_68_face_landmarks.dat.
I tried to copy the file to the directory of my python file, but still not working.
Thanks in advance
I wrote a simple script using face_recognition python library. But when I tried to execute the script I am getting below error.
Traceback (most recent call last):
File "face.py", line 1, in <module>
import face_recognition
File "/home/user/.local/lib/python3.7/site-packages/face_recognition/__init__.py", line 7, in <module>
from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
File "/home/user/.local/lib/python3.7/site-packages/face_recognition/api.py", line 4, in <module>
import dlib
ImportError: Python version mismatch: module was compiled for version 3.8, while the interpreter is running version 3.7.
How to resolve it?
Install Python 3.8, this would solve the problem
I just have installed wxPython and python toolkit 18.08 in Ubuntu 20.04.But,while runnimg from command line python PTK.pyw, I got an error as below
> Traceback (most recent call last):
File "PTK.pyw", line 10, in <module>
import ptk_lib.app as app
File "/home/jobayer/下载/PythonToolkit-18.08/ptk_lib/app.py", line 17, in <module>
from ptk_lib.message_bus.mb_node import MBLocalNode
File "/home/jobayer/下载/PythonToolkit-18.08/ptk_lib/message_bus/mb_node.py", line 14, in <module>
import mb_protocol
ModuleNotFoundError: No module named 'mb_protocol'
I did not find mb_protocol module any where.Where can I find this module?
Have a compiled app that fails when multiarray attempts to import py31compat. It runs fine from source.
I am using Anaconda2-4.4.0-Windowsx86_64.exe (windows 7)
Using numpy-1.12.1, which was installed with pip
Compiling with py2exe script.
The error it gives is:
Traceback (most recent call last):
File "AutoFastener.py", line 23, in <module>
File "BatchControl\modBatchController.pyo", line 94, in <module>
File "FastenerDataSetUtilities\modFDDUtils.pyo", line 21, in <module>
File "scipy\__init__.pyo", line 61, in <module>
File "numpy\__init__.pyo", line 180, in <module>
File "numpy\add_newdocs.pyo", line 13, in <module>
File "numpy\lib\__init__.pyo", line 8, in <module>
File "numpy\lib\type_check.pyo", line 11, in <module>
File "numpy\core\__init__.pyo", line 23, in <module>
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
cannot import name py31compat
I've tried upgrading setuptools and distribute with pip, which did not help.
I've looked in the executables LIB file, and the pkg_resources has py31compat.pyo in it, which as far as I've been able to determine is where it should be.
I don't know how to figure out where the multiarray.pyd is trying to load it from.
First file i'm trying to install an external package - twitter 1.14.3 (on windows 7)
so i downloaded the package to c:\python33\twitter-1.14.3,
then i run:
python.exe c:\python33\twitter-1.14.3\setup.py install
Finished processing..
Now i'm trying to use that new module:
from twitter import *
and i get an error:
Traceback (most recent call last):
File "test1.py", line 1, in <module>
\ufefffrom twitter import *
ImportError: No module named 'twitter'
When i'm trying to run the twitter.exe, i get:
c:\Python33\Scripts>twitter.exe
Traceback (most recent call last):
File "c:\Python33\Scripts\twitter-script.py", line 9, in <module>
load_entry_point('twitter==1.14.3', 'console_scripts', 'twitter')()
File "c:\Python33\lib\site-packages\setuptools-5.4.1-py3.3.egg\pkg_resources.py", line 356, in load_entry_point
File "c:\Python33\lib\site-packages\setuptools-5.4.1-py3.3.egg\pkg_resources.py", line 2476, in load_entry_point
File "c:\Python33\lib\site-packages\setuptools-5.4.1-py3.3.egg\pkg_resources.py", line 2190, in load
ImportError: No module named 'twitter'
Any ideas?
Thanks/
Navigate to your friendly neighborhood Command Prompt and type in the following:
pip install twitter
It should say something along the lines of "Installing collected packages... Successfully installed twitter-1.18.0"
Then run from your IDE:
import twitter # work with Twitter APIs
And proceed with setting up your API keys