ageitgey / face_recognition

The world's simplest facial recognition api for Python and the command line
MIT License
53.45k stars 13.49k forks source link

ImportError: cannot import name '_imaging' #1025

Open JoaozinhoKz4 opened 4 years ago

JoaozinhoKz4 commented 4 years ago

Description

Have been working with mysql databases and face_recognition module for a while now, but since my last workspace change I cant even run my regularly sign up script. Ran it as a .dbg to try to fix my issue. But received this output.

What I Did

python3-dbg cadastro.py

Output:


File "cadastro.py", line 1, in <module>
    import face_recognition #importa o módulo face_recognition
  File "/home/sca/.local/lib/python3.6/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/sca/.local/lib/python3.6/site-packages/face_recognition/api.py", line 3, in <module>
    from PIL import Image
  File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 69, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "cadastro.py", line 1, in <module>
    import face_recognition #importa o módulo face_recognition
  File "/home/sca/.local/lib/python3.6/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/sca/.local/lib/python3.6/site-packages/face_recognition/api.py", line 3, in <module>
    from PIL import Image
  File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 69, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging'
´´´
govindsartaj commented 4 years ago

Did you figure this out? I have the same error and cannot figure it out.

JoaozinhoKz4 commented 4 years ago

Actually, just reinstalled my VM with more RAM and it worked.

lathigarachetan commented 11 months ago

Facing same issue with RHEL7, Python3.11.4 with Pillow (PIL - 10.1.0) -

Error :

from PIL import Image Traceback (most recent call last): File "", line 1, in File "[path]/lib/python3.11/site-packages/PIL/Image.py", line 82, in from . import _imaging as core ImportError: cannot import name '_imaging' from 'PIL' ([path]/lib/python3.11/site-packages/PIL/init.py)

Please help as unable to find more answers on this error.

fredodi commented 10 months ago

same problem here. i tried both python 2.7.18 and 3.12.1