Search code examples
pythondllscikit-image

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


I'm facing a problem while importing following Python module. I am working on Jupyter and my imported modules are -

import numpy as np
from scipy import misc
from skimage import data

At the time I tried to run it, I got following errors. However, I'm using Anaconda with Python 3.6 and SciPy 1.0.0, scikit-image 0.13.1, NumPy 1.14.0.

ImportError                               Traceback (most recent call last)
<ipython-input-5-23140aba6e54> in <module>()
      3 from scipy import misc
      4 import matplotlib.pyplot as plt
----> 5 from skimage import data
      6 photo_data = misc.imread('F:\Python\Python for Data Science\Week 3\Week-3-Numpy\wifire\sd-3layers.jpg')

~\Anaconda3\lib\site-packages\skimage\data\__init__.py in <module>()
     14
     15 from .. import data_dir
---> 16 from ..io import imread, use_plugin
     17 from .._shared._warnings import expected_warnings
     18 from ._binary_blobs import binary_blobs

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

Surprisingly I ran the same code few months ago and it's OK and now I'm getting these errors, showing the ImportError and indicating skimage with arrow keys in tracback.

So, I thought this problem is more about Windows system related missing file issue than Python code obvious, and so I tried to solved it by this solution. But it didn't work for me.


Solution

  • This is one of the solutions that worked for me.

    Quick Note - in the system, installed Python packages were SciPy 1.0.0, scikit-image 0.13.1, and imageio v 2.2.0. I'm using the Anaconda Python 3.6 distribution.

    Solution

    • Uninstall Anaconda (I need to do this, but you may not)
    • Download Visual C++ 2017 Redistributable packages (according to your system)
    • Install redistribution file and Anaconda both and then restart the PC.

    However, I've already installed NumPy + mkl on my system. Then run the following again-

    from scipy import misc
    photo_data = misc.imread('F:\Python\sd-3layers.jpg')
    

    And this time, rather than giving me the "DLL load failed" error, it gives me information -

    C:\Users\P\Anaconda3\lib\site-packages\ipykernel_launcher.py:4: DeprecationWarning: `imread` is deprecated!
    `imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
    Use ``imageio.imread`` instead.
      after removing the cwd from sys.path.
    

    Then I tried following, using the imageio package, and it ran properly.

    import imageio
    photo_data = imageio.imread('F:\Python\sd-3layers.jpg')