-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError #8049
Comments
You're importing Pillow in your code, but you're not using it. So if your goal is to just run the code you've posted, and you believe Pillow is in your way, then you can stop importing Pillow. import cv2
import face_recognition
import pickle
import os
# importing the student images
folderPath = 'Images'
modePathList = os.listdir(folderPath)
imgList = []
for path in modePathList:
imgList.append(cv2.imread(os.path.join(folderPath, path)))
print(len(imgList)) However, Iooking at your error, I don't think Pillow is the cause of your problem. I think face_recognition is. I would suggest import cv2
import os
# importing the student images
folderPath = 'Images'
modePathList = os.listdir(folderPath)
imgList = []
for path in modePathList:
imgList.append(cv2.imread(os.path.join(folderPath, path)))
print(len(imgList)) |
If that does solve your problem, but you would still like to use face_recognition, that isn't a Pillow problem, so I would suggest that this is a matter for https://github.com/ageitgey/face_recognition or https://stackoverflow.com/. To be helpful though, Homebrew/homebrew-core#153177 suggests that running |
thank you it worked for me. I just need to import cv2 and os |
but I'm still getting the same error when i'm using face_recognition library and now i'm using it in the code. |
Homebrew/homebrew-core#153177 suggests that running However, that isn't a Pillow problem. This might be a matter for https://github.com/ageitgey/face_recognition or https://stackoverflow.com/ instead. |
i run Traceback (most recent call last):
File "/Users/vijaychoudhary/Desktop/face reco/EncodeGenerator.py", line 2, in <module>
import face_recognition
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/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 "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/face_recognition/api.py", line 4, in <module>
import dlib
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/dlib/__init__.py", line 19, in <module>
from _dlib_pybind11 import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_dlib_pybind11.cpython-310-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/ffmpeg/lib/libavdevice.60.dylib
Referenced from: <2D7DF8F2-EE4E-333E-B755-5CCB2B984C06> /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_dlib_pybind11.cpython-310-darwin.so
Reason: tried: '/opt/homebrew/opt/ffmpeg/lib/libavdevice.60.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/ffmpeg/lib/libavdevice.60.dylib' (no such file), '/opt/homebrew/opt/ffmpeg/lib/libavdevice.60.dylib' (no such file), '/opt/homebrew/Cellar/ffmpeg/7.0_1/lib/libavdevice.60.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/ffmpeg/7.0_1/lib/libavdevice.60.dylib' (no such file), '/opt/homebrew/Cellar/ffmpeg/7.0_1/lib/libavdevice.60.dylib' (no such file)
Process finished with exit code 1 |
Again, the problem you're describing is not a Pillow one, so there are other places that would be more helpful to you. ageitgey/face_recognition#1534 and ageitgey/face_recognition#1536 are face_recognition users asking very similar questions. You might want to ask if they ever found a solution. |
What did you do?
I have just append the images in face recognition project
What did you expect to happen?
I want to print the total number of images
What actually happened?
I got an ImportError
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: