Skip to content

Instantly share code, notes, and snippets.

@paulgribble
Forked from rmcgibbo/install.sh
Created September 10, 2012 02:29
Show Gist options
  • Save paulgribble/3688478 to your computer and use it in GitHub Desktop.
Save paulgribble/3688478 to your computer and use it in GitHub Desktop.
Install Python / numpy / scipy / ipython / matplotlib / umfpack / pytables from source
#!/bin/bash
# =================================================================
# Install a full scientific python stack from source, for Ubuntu, with
# python 2.7.3 (tested on a totally fresh Ubuntu12.04-amd64). Requires
# sudo for apt-getting dependencies like libatlas, Tk, etc
# =================================================================
# packages pulled from PyPI are currently
# scipy 0.10.1
# numpy 1.6.2
# ipython 0.13
# matplotlib 1.1.0 (Tk backend)
# numexpr 2.0.1
# cython 0.16
# pytables 2.4.0
# scikits.umfpack 5.1.0
# deap 0.8
# fastcluster 1.1.6
# will also install msmbuilder 2.5.1 if you have it in your home directory
# (and the boring ones are)
# setuptools 0.6c11
# pip 1.1
# nose 1.1.2
# virtualenv 1.7.2
# virtualenvwrapper 3.6
# we're going to install everything in $HOME/local
cd $HOME
mkdir -p local
cd local
# install libraries for python itself
sudo apt-get upgrade
sudo apt-get install -qq build-essential libz-dev libreadline-dev
sudo apt-get install -qq libncursesw5-dev libssl-dev libgdbm-dev
sudo apt-get install -qq libsqlite3-dev libbz2-dev zlib1g-dev
# install svn
sudo apt-get install -qq subversion
# install libraries for science
sudo apt-get install -qq gfortran swig liblapack-dev libzmq-dev
sudo apt-get install -qq libatlas-base-dev libjpeg-dev libhdf5-serial-dev
sudo apt-get install -qq liblzo2-dev libsuitesparse-dev
# install libraries for matplotlib
sudo apt-get install -qq libpng12-dev libfreetype6-dev tk-dev
# install python
if [ ! -d "$HOME/local/python" ]; then
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xzvf Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=$HOME/local/python
make
make install
cd ..
else
echo "python already installed"
fi
# add python to path
export PATH=$HOME/local/python/bin:$PATH
#install python's setuptools
if [ ! -d "$HOME/local/setuptools-0.6c11" ]; then
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
tar -xzvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py install
cd ..
else
echo "setuptools already installed"
fi
# get the better python package manager, pip
easy_install pip
# install remaining python packages through pip
pip install numpy # core numerics library
pip install nose # testing library
pip install numexpr # prereq for tables
pip install cython # prereq for tables
pip install tables # hdf5 support for python (savig big arrays on disk)
pip install scipy # science stuff
pip install ipython # nice interactive prompt
pip install deap # mpi stuff
pip install pyzmq # socket lib for ipython.parallel
pip install fastcluster # fast hierarchical clustering library
# install matplotlib with the Tk backend, but not gtk
# if you want the gtk backend, there are a lot more dependencies
# since pip cannot install pygtk
pip install matplotlib
# install scikits.umfpack
if [ ! -d "$HOME/local/umfpack" ]; then
svn checkout http://svn.scipy.org/svn/scikits/trunk/umfpack/
cd umfpack
python setup.py install
fi
pip install tornado
echo "Add $HOME/local/python/bin to your path (e.g. .bashrc)"
echo ""
echo 'echo "export PATH=\$HOME/local/python/bin:\$PATH" >> ~/.bashrc'
pip install virtualenv
pip install virtualenvwrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment