Imageai: cannot import name '_imaging' from 'PIL'

Created on 21 Mar 2019  路  4Comments  路  Source: OlafenwaMoses/ImageAI

\idenprof> py .\train.py
Traceback (most recent call last):
File ".\train.py", line 1, in
from imageai.Prediction.Custom import ModelTraining
File "C:\Users\danieAppData\Local\Programs\Python\Python37\lib\site-packages\imageai\Prediction__init__.py", line 3, in
from PIL import Image
File "C:\Users\danieAppData\Roaming\Python\Python37\site-packages\PIL\Image.py", line 94, in
from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (C:\Users\danieAppData\Roaming\Python\Python37\site-packages\PIL__init__.py)

I have no idea where to start debugging this. Am I using outdated modules or something?

Install commands:

pip install --user tensorflow numpy scipy pillow matplotlib h5py keras

pip install https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.2/imageai-2.0.2-py3-none-any.whl

Most helpful comment

Same as above

I had the same error (ImportError: cannot import name '_imaging' from 'PIL') when upgrading to Python 3.8.4 - July 13, 2020 64bit for Windows,
I did pip uninstall Pillowand found that I had another old version lying around. I uninstalled again until there were no versions left. Then I did a pip install Pillowand it worked just fine.

All 4 comments

The solutions at stackexchange did not work. The most straightforward solution recommended

pip install --no-index -f https://dist.plone.org/thirdparty/ -U PIL pip install Pillow pip uninstall PIL pip uninstall Pillow pip install Pillow

When I tried the first command I got
ERROR: Complete output from command python setup.py egg_info: ERROR: Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/pip-install-j3hyp1fu/PIL/setup.py", line 169 print "--- using Tcl/Tk libraries at", TCL_ROOT ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("--- using Tcl/Tk libraries at", TCL_ROOT)? ---------------------------------------- ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/vd/5ccxv4957f1_prjqt1l_ppsw0000gq/T/pip-install-j3hyp1fu/PIL/

Same as above

Same as above

I had the same error (ImportError: cannot import name '_imaging' from 'PIL') when upgrading to Python 3.8.4 - July 13, 2020 64bit for Windows,
I did pip uninstall Pillowand found that I had another old version lying around. I uninstalled again until there were no versions left. Then I did a pip install Pillowand it worked just fine.

Was this page helpful?
0 / 5 - 0 ratings