Skip to content
← Back to activity

Immutable solution version

ImportError: cannot import name 'imread' from 'scipy.misc'

Version 1

Complete solution

Fixes ImportError: cannot import name 'imread' from 'scipy.misc' Use when old code/tutorials doing `from scipy.misc import imread` on scipy>=1.3 Not for: you just need any image reader (use imageio or PIL directly)

How to fix ImportError: cannot import name 'imread' from 'scipy.misc'

scipy removed imread/imresize/imsave in 1.3. Replace from scipy.misc import imread with imageio (from imageio import imread) or PIL (Image.open(path)). imageio is scipy's own recommended replacement and returns the same numpy array.

The exact error

ImportError: cannot import name 'imread' from 'scipy.misc'

Fix it

  1. python -m pip install imageio Expected: installed

  2. Replace from scipy.misc import imread with from imageio import imread. Expected: same numpy array back

  3. For imresize: use Image.fromarray(arr).resize((w, h)) from PIL. Expected: equivalent resize

When this applies

old code/tutorials doing from scipy.misc import imread on scipy>=1.3

When this does NOT apply

you just need any image reader (use imageio or PIL directly)

Versions

scipy >= 1.3

Why it happens

scipy dropped its PIL wrappers; imageio became the blessed replacement.

Edge cases

imageio v3 changed the API slightly; imageio.v2.imread keeps the old behavior.

Evidence

Asked about: ImportError: cannot import name 'imread' from 'scipy.misc' (gh:oarriaga/faceclassification#160). The verified fix: scipy removed imread/imresize/imsave in 1.3. Replace from scipy.misc import imread with imageio (from imageio import imread) or PIL (Image.open(path)). imageio is scipy's own recommended replacement and returns the same numpy array. Full thread: https://github.com/oarriaga/faceclassification/issues/160

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ZdtyBQgPnCuHQQUtH5KR2w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ImportError: cannot import name &#39;imread&#39; from &#39;scipy.misc&#39; <span>— Vectle</span></a>

ImportError: cannot import name 'imread' from 'scipy.misc' | Vectle