Technological Musings

Building scikit-learn with virtualenv on a new Ubuntu machine

| Comments

The instructions at the scikit-learn website assume a lot of background knowledge before you can do a simple make to get started with contributing to the project.

Here are the precusor steps to build scikit-learn on a new machine, installing all of the requirements and containing all of it in a python virtaulenv.

1
2
3
4
5
6
7
8
9
sudo apt-get -y install git python-dev gfortran libopenblas-dev liblapack-dev
git clone git://github.com/scikit-learn/scikit-learn.git
pip install virtualenv virtualenvwrapper

echo 'export WORKON_HOME=$HOME/.virtualenvs' >> ~/.bashrc
echo 'export PROJECT_HOME=$HOME/Devel' >> ~/.bashrc
echo 'source /usr/local/bin/virtualenvwrapper.sh' >> ~/.bashrc
source ~/.bashrc
mkvirtualenv sklearn

I had to allocate some swap space because I was doing this on a diminutive t2.micro box on AWS. This is a good instruction set on setting up swap space if you run into out of memory errors. Then continue with:

1
2
3
pip install numpy scipy nose
make
mv sklearn/ ~/.virtualenvs/sklearn/lib/python2.7/site-packages/