DaveD
DaveD

Reputation: 21

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

Ive updated my Python version from 3.5.4 to 3.6.6 (in Anaconda 3) and now the line

    from sklearn.metrics.pairwise import cosine_similarity

causes the following error:

    Traceback (most recent call last):

      File "<ipython-input-3-743ac88bcf9a>", line 1, in <module>
        from sklearn.metrics.pairwise import cosine_similarity

      File "F:\Program Files\lib\site-packages\sklearn\__init__.py", line 64, in <module>
        from .base import clone

      File "F:\Program Files\lib\site-packages\sklearn\base.py", line 13, in <module>
        from .utils.fixes import signature

      File "F:\Program Files\lib\site-packages\sklearn\utils\__init__.py", line 13, in <module>
        from .validation import (as_float_array,

      File "F:\Program Files\lib\site-packages\sklearn\utils\validation.py", line 22, in <module>
        from ..utils.fixes import signature

      File "F:\Program Files\lib\site-packages\sklearn\utils\fixes.py", line 83, in <module>
        from scipy.special import boxcox  # noqa

      File "F:\Program Files\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
        from ._ufuncs import *

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

Im on Windows 7, 64-bit; previously the line worked fine, and other packages (Pandas, Numpy etc) still work, so it doesn't appear to be a PATH issue as some have suggested.

Ive seen numerous similar questions but all solutions have so far failed. E.g.

Does anyone have any further suggestions (specific to Anaconda etc)?

Upvotes: 2

Views: 7126

Answers (1)

Miguel
Miguel

Reputation: 71

I solved it, and (in my case) the problem was scipy, not sklearn. What i did was uninstall scipy with conda: conda remove --force scipy, and then install it with pip: pip install scipy. That worked for me.

Upvotes: 4

Related Questions