GithubHelp home page GithubHelp logo

ImportError about pillow HOT 7 CLOSED

itsvijaychoudhary avatar itsvijaychoudhary commented on June 22, 2024
ImportError

from pillow.

Comments (7)

radarhere avatar radarhere commented on June 22, 2024 1

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))

from pillow.

radarhere avatar radarhere commented on June 22, 2024

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 brew reinstall librist might fix your issue.

from pillow.

itsvijaychoudhary avatar itsvijaychoudhary commented on June 22, 2024

thank you it worked for me. I just need to import cv2 and os

from pillow.

itsvijaychoudhary avatar itsvijaychoudhary commented on June 22, 2024

but I'm still getting the same error when i'm using face_recognition library and now i'm using it in the code.
how do i solve that?

from pillow.

radarhere avatar radarhere commented on June 22, 2024

Homebrew/homebrew-core#153177 suggests that running brew reinstall librist might fix your issue.

However, that isn't a Pillow problem. This might be a matter for https://github.com/ageitgey/face_recognition or https://stackoverflow.com/ instead.

from pillow.

itsvijaychoudhary avatar itsvijaychoudhary commented on June 22, 2024

i run brew reinstall librist and after that i run the same program in pycharm and got this error.

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

from pillow.

radarhere avatar radarhere commented on June 22, 2024

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.

from pillow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.