1

I'm new in Python and I'm trying to install Python's library scikit-learn, but I get the following error:

building data_files sources
build_src: building npy-pkg config files
running build_py
running build_clib
No module named msvccompiler in numpy.distutils; trying from distutils
customize MSVCCompiler
Missing compiler_cxx fix for MSVCCompiler
customize MSVCCompiler using build_clib
building 'libsvm-skl' library
compiling C sources
error: Unable to find vcvarsall.bat

I use python 2.7, and I downloaded the scikit-learn from http://scikit-learn.org/dev/install.html

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rafel Rigo
  • 11
  • 1

2 Answers2

0

This error occurs because the installer is trying to compile some C/C++ source code, but can't find your compiler in the path.

On Windows, I usually find it much easier to install already compiled binary versions of the various Python packages. You can find such precompiled packages here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

The scikit-learn package is here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn

After downloading, simply invoke pip on the files. Make sure also to install numpy and scipy from there, if you don't have them already.

cfh
  • 4,576
  • 1
  • 24
  • 34
  • 1
    I would also recommend using anaconda. – Andreas Mueller May 03 '15 at 22:57
  • @AndreasMueller: Anaconda makes you pay for linking to the faster Intel MKL linear algebra routines, while you get them for free if you install the binary packages yourself. So I'm personally not a fan. – cfh May 03 '15 at 23:04
  • Anaconda is free with mkl for academic use. How do you get MKL for free as a non-academic user? – Andreas Mueller May 03 '15 at 23:21
  • @AndreasMueller: [This package](http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) includes it. – cfh May 03 '15 at 23:26
  • Huh, it is statically linked. Is that allowed by the mkl license? Or does he have a deal with intel? I don't understand how this works. – Andreas Mueller May 04 '15 at 00:44
  • 1
    @AndreasMueller: I think the license is only needed to do the actual linking with the MKL, not to redistribute the final result. [See here.](https://software.intel.com/en-us/articles/intel-math-kernel-library-licensing-faq#redistribute) – cfh May 04 '15 at 01:11
0

You can install sklearn along with other essential libraries, numpy and scipy on ubuntu as follows,

apt-get update; \
apt-get install -y \
  python python-pip \
  python-numpy \
  python-scipy \
  build-essential \
  python-dev \
  python-setuptools \
  libatlas-dev \
  libatlas3gf-base

update-alternatives --set libblas.so.3 \
  /usr/lib/atlas-base/atlas/libblas.so.3; \
update-alternatives --set liblapack.so.3 \
  /usr/lib/atlas-base/atlas/liblapack.so.3

pip install -U scikit-learn

Instead, you can also use Docker images, either by using its Dockerfile

You can also try using datmo in order setup environment and track machine learning projects for making it reproducible using datmo CLI tool.

Shabaz Patel
  • 281
  • 1
  • 10