2

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)?

DaveD
  • 21
  • 1
  • 5

1 Answers1

4

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.

Miguel
  • 71
  • 5
  • 1
    Id already tried removing scipy (previous similar problems); in the end I wiped Anaconda and re-installed; seems Im stuck with Python 3.5 for now – DaveD Nov 28 '18 at 20:36