My scipy.misc module appears to be missing imsave

Cramer picture Cramer · Nov 15, 2013 · Viewed 37k times · Source

I open the python3 interpreter and type

import scipy.misc
scipy.misc.imsave

with the result

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'imsave'

Has the name changed? It works fine in python2 but I would rather not migrate backwards so to speak.

I have python 3.3.1 on Lubuntu 13.04 with all the modules downloaded from the default repositories. Scipy is installed and print(scipy.misc.__doc__) shows that imsave should be there.

EDIT:

scipy.__version__ gives 0.11.0

from scipy.misc import imsave gives

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name imsave

Answer

Ivona Tau picture Ivona Tau · Jun 4, 2019

scipy.misc.imsave has been deprecated in newer Scipy versions.

Change your code to:

import imageio
imageio.imwrite('filename.jpg', array)