Importing image to python :cannot import name 'imread'

You also need to install PIL (Pillow) as that is what scipy uses to read images:

pip install Pillow

note from the docs:

imread uses the Python Imaging Library (PIL) to read an image. The following notes are from the PIL documentation.

however, you might want to think about switching to scipy.imageio.imread since scipy.misc.imread is deprecated :

imread is deprecated! imread is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use imageio.imread instead


Use:

from imageio import imread

it worked for me.


Apparently a lot of people had this issue and the solution was to install Pillow. Perhaps try to install Pillow and run it again

sudo pip install Pillow==2.6.0

Source of information: https://github.com/Newmu/stylize/issues/1

Tags:

Python