Scikit Learn

For the most part, installing new packages with Python is a breeze. But if you're reading this it's probably because you ran into an error while installing Scikit Learn and the answers online are not as helpful as they should be. You may have even gotten the infamous error:

no lapack/blas resources found

This post will fix all of your problems and be a straightforward guide to installing Scikit Learn and any dependencies required so you can get started with machine learning!

Step 1: Check your version of Python

You can easily check what version of Python you have installed by either opening up IDLE (which will tell you the version you have installed at the top) or you can press start, type in cmd and then in the command prompt type python.exe.

Pay attention to whether or not your Python is a 32-bit or 64-bit version. This will be important when deciding which packages we need to download.

Step 2: Download & Install Numpy+MKL

The first thing you need to do is install Numpy...but not just the regular ol' Numpy. No, no, no that would be too easy. Because Scikit Learn and Scipy have certain dependencies you need to install a version called Numpy+MKL and so pip install numpy will NOT work.

Click on this link to download Nump+MKL: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

You should see the following options:

Numpy+MKL Versions

It may look confusing and that's because it is - but we will help break it down for you.

Ignore everything before the cp part. That tells you what version of Python it's for. If you have Python 3.6 then you would choose cp36. If you have Python 2.7 then you would download the file with cp27, etc.

The second thing you need to know is the last part of the file name where it either says win32 or win_amd64. This tells you it is for either a 32-bit version of Python or a 64-bit version of Python. If you download the 64-bit version (win_amd64) and your Python version is 32-bit, you're gonna have a bad time.

In the above example, I would download the highlighted file because I have the 64-bit Python 3.6 version installed.

Once you have the file downloaded, open up a command prompt window again. Then you can simply type in pip install "file path".

For example:

pip install "C:\Users\John\Downloads\numpy-1.13.3+mkl-cp36-cp36m-win_amd64.whl"

Step 3: Download & Install Scipy the same way

The same exact download and install process applies for scipy. Download the appropriate .whl file from the link below.

Scipy download link: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

Again, once you have successfully downloaded the .whl file you will open up command prompt (or hopefully still have it open) and type pip install "file path".

For example:

pip install "C:\Users\John\Downloads\scipy-1.0.0rc1-cp36-cp36m-win_amd64.whl"

Step 4: Install Scikit Learn

Finally:

pip install sklearn

And it's that easy!

Alternatively, you could have just used Anaconda which makes installing these packages way easier.

If you don't already have Anaconda installed, start here: Python Packages for Machine Learning

If you already have Anaconda installed, read this: How To Install Python Machine Learning Packages Using Anaconda