Scikit install asks for Scipy even though it is installed

Question:

I am trying to install Scikit by running:

pip install scikit-learn

When I run it, I get this message:

Collecting scikit-learn
  Using cached scikit-learn-0.18.1.tar.gz
Installing collected packages: scikit-learn
  Running setup.py install for scikit-learn ... error
    Complete output from command c:python36python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\USER\AppData\Local\Temp\pip-build-3080ikpy\scikit-learn\setup.py';f=getatt
r(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersUSERAppDataLocalTemppip-04zx4iu6-recordi
nstall-record.txt --single-version-externally-managed --compile:
    Partial import of sklearn during the build process.
    Traceback (most recent call last):
      File "C:UsersUSERAppDataLocalTemppip-build-3080ikpyscikit-learnsetup.py", line 149, in get_scipy_status
        import scipy
      File "c:python36libsite-packagesscipy__init__.py", line 61, in <module>
        from numpy._distributor_init import NUMPY_MKL  # requires numpy+mkl
    ImportError: cannot import name 'NUMPY_MKL'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersUSERAppDataLocalTemppip-build-3080ikpyscikit-learnsetup.py", line 270, in <module>
        setup_package()
      File "C:UsersUSERAppDataLocalTemppip-build-3080ikpyscikit-learnsetup.py", line 260, in setup_package
        .format(scipy_req_str, instructions))
    ImportError: Scientific Python (SciPy) is not installed.
    scikit-learn requires SciPy >= 0.9.
    Installation instructions are available on the scikit-learn website: http://scikit-learn.org/stable/install.html

Which seems to ask me to install Scipy, however I already have Scipy installed, and indeed if I run

pip install scipy

I get

Requirement already satisfied: scipy in c:python36libsite-packages
Requirement already satisfied: numpy>=1.8.2 in c:python36libsite-packages (from scipy)
Asked By: Nadni

||

Answers:

Your install shows this: from numpy._distributor_init import NUMPY_MKL # requires numpy+mkl ImportError: cannot import name 'NUMPY_MKL'

So you need to do a few things. Get the right SciPy: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

Get the right NumPy: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

Get the right SciKit Learn: http://www.lfd.uci.edu/~gohlke/pythonlibs/#sci-kitlearn

Now do pip uninstall each of your other packages. Then do pip install the wheels you downloaded at those links provided – NumPy 1st, SciPy 2nd, then Ski-kitlearn last. That should then solve your issue. Note at those links you’re downloading the files with cp36‑cp36m‑win32.whlor cp36‑cp36m‑win_amd64.whl depending on if you have 32bit or 64bit Python installed.

Answered By: Matt
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.