ImportError: DLL load failed: The specified module could not be found

I went back to work on the first lesson and now I’m getting errors with PILL(pillow).
I seem to be getting this error in a number of other notebooks as well. Things were working yesterday and I can’t remember what I changed. I uninstalled pillow and reinstalled. That didn’t seem to work.

Ideas? Thank you.

from fastai.imports import *


ImportError Traceback (most recent call last)
in ()
1 # This file contains all the main external libs we’ll use
----> 2 from fastai.imports import *

~\Projects - ML\fastai\fastai\imports.py in ()
14 from pandas_summary import DataFrameSummary
15 from IPython.lib.display import FileLink
—> 16 from PIL import Image, ImageEnhance, ImageOps
17 from sklearn import metrics, ensemble, preprocessing
18 from operator import itemgetter, attrgetter

~\Anaconda3\envs\fastai-cpu\lib\site-packages\PIL\Image.py in ()
58 # Also note that Image.core is not a publicly documented interface,
59 # and should be considered private and subject to change.
—> 60 from . import _imaging as core
61 if PILLOW_VERSION != getattr(core, ‘PILLOW_VERSION’, None):
62 raise ImportError("The _imaging extension was built for another "

ImportError: DLL load failed: The specified module could not be found.

Solved.

Instead of using conda to uninstall and reinstall I used pip and that seemed to fix the problem.

Use Pillow from conda-forge:

conda install -c conda-forge Pillow

I’ve had this problem on multiple computers and Python installations and environments, especially if some of the components are from conda-forge but Pillow isn’t, and switching to the conda-forge version of Pillow always works like a charm!

1 Like

Hi @xjdeng @lspironello

I’m facing the below issue can you give me any suggestions what to do?

it’s in lesson4-mnist_sgd.ipynb

image

I have tried conda install -c defaults intel-openmp -f but it doesn’t work.

Thanks,
Sumit