[Solve] ImportError: cannot import name ‘imresize’ from ‘scipy.misc’

Usually, when we install scipy package via conda, conda installs the last version of that package (currently is 1.5.3)

conda install scipy

Solutions

The first one is using pip or conda selecting the specific version to install:

pip install scipy==1.1.0
conda install scipy==1.1.0

The second one is just replacing the function with PIL like the following:
You have this code to resize some image:

from scipy.misc import imreadimg_resized = imresize(img, (width, height)), interp='bicubic', mode='F')

To solve the problem presented, you just need to change the library and some code like:

from PIL import Image
import numpy as np
img_resized= np.array(Image.fromarray(obj=img, mode='F').resize(size=(width, height), resample=Image.BICUBIC)

I hope you enjoy this post :D :D

--

--

Computer Scientist at(@UNIoficial) and Cat lover ❤. Visit http://www.fmorenovr.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store