ModuleNotFoundError: No module named 'scipy.misc.pilutil'
Question:
I am not able to import scipy.misc.pilutil
Though I have pillow and scipy installed. I am able to import scipy.misc but can’t use functions like imresize
from scipy.misc.pilutil import imresize
ModuleNotFoundError
Traceback (most recent call last)
<ipython-input-20-a7ba6cfb7450> in <module>()
----> 1 from scipy.misc.pilutil import imsave
ModuleNotFoundError: No module named 'scipy.misc.pilutil'
Answers:
You get this error because you are using scipy v1.3.0 and imresize() is deprecated.
Also make sure you have Pillow installed.
See here: https://docs.scipy.org/doc/scipy-1.2.1/reference/generated/scipy.misc.imresize.html
“imresize is deprecated in SciPy 1.0.0, and will be removed in 1.3.0.”
Either downgrade to v1.2.x or use Pillow resize() instead: numpy.array(Image.fromarray(arr).resize()).
Check your scipy version. I had the same issue and after I’ve changed the scipy version to 1.1.0. the issue disappeared.
To check the scipy version in the terminal:
import scipy
scipy.version.full_version
The newer version of scipy has removed the imsave
and many other functions such as resize
, you can install older version of scipy with following:
pip install scipy==1.1.0
I am not able to import scipy.misc.pilutil
Though I have pillow and scipy installed. I am able to import scipy.misc but can’t use functions like imresize
from scipy.misc.pilutil import imresize
ModuleNotFoundError
Traceback (most recent call last)
<ipython-input-20-a7ba6cfb7450> in <module>()
----> 1 from scipy.misc.pilutil import imsave
ModuleNotFoundError: No module named 'scipy.misc.pilutil'
You get this error because you are using scipy v1.3.0 and imresize() is deprecated.
Also make sure you have Pillow installed.
See here: https://docs.scipy.org/doc/scipy-1.2.1/reference/generated/scipy.misc.imresize.html
“imresize is deprecated in SciPy 1.0.0, and will be removed in 1.3.0.”
Either downgrade to v1.2.x or use Pillow resize() instead: numpy.array(Image.fromarray(arr).resize()).
Check your scipy version. I had the same issue and after I’ve changed the scipy version to 1.1.0. the issue disappeared.
To check the scipy version in the terminal:
import scipy
scipy.version.full_version
The newer version of scipy has removed the imsave
and many other functions such as resize
, you can install older version of scipy with following:
pip install scipy==1.1.0