I've seen this problem before with other people, but haven't found a fix.
All I'm trying to do is:
from scipy.misc import imread
and I get
/home1/users/joe.borg/<ipython-input-2-f9d3d927b58f> in <module>() ----> 1 from scipy.misc import imread /software/Python/272/lib/python2.7/site-packages/scipy/misc/__init__.py in <module>() 16 try: 17 from pilutil import * ---> 18 __all__ += pilutil.__all__ 19 except ImportError: 20 pass NameError: name 'pilutil' is not defined
But it's fine when I do from pilutil import *
on its own (no import error). Even .../site-packages/scipy/misc/pilutil.py exists so I've got no idea why this is failing.
Install SciPy using the pip command Python consists of pip command which is an official package installer. It is a package manager, we can install, delete, or update any package. We need to install pip for using the pip command.
misc) Various utilities that don't have another home. Note that the Python Imaging Library (PIL) is not a dependency of SciPy and therefore the pilutil module is not available on systems that don't have PIL installed.
Type and run pip install scipy in the command prompt. This will use the Python Package index, and install the core SciPy packages on your computer. You can also install other core packages like Numpy and Matplotlib by using the pip install numpy and pip install matplotlib commands.
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 Show activity on this post. it worked for me. Show activity on this post.
You also need to install PIL (Pillow) as that is what scipy uses to read images: imread uses the Python Imaging Library (PIL) to read an image.
TensorFlow Long Short-Term Memory Network PyTorch Machine Learning WordPress PHP Linux Matplotlib PyQT5 Fix Python module ‘scipy.misc’ has no attribute ‘imread’ – Python Tutorial By admin|June 16, 2020 2 Comments When you are processing images using python, you may encounter this error: module ‘scipy.misc’ has no attribute ‘imread’.
imread is deprecated! imread is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use imageio.imread instead. Read an image from a file as an array. This function is only available if Python Imaging Library (PIL) is installed.
If you have Pillow
installed with scipy
and it is still giving you error then check your scipy
version because it has been removed from scipy since 1.3.0rc1
.
rather install scipy 1.1.0
by :
pip install scipy==1.1.0
check https://github.com/scipy/scipy/issues/6212
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With