Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save amirsani/d2aa0763cc138902bf73 to your computer and use it in GitHub Desktop.
Save amirsani/d2aa0763cc138902bf73 to your computer and use it in GitHub Desktop.
# based on http://osdf.github.io/blog/numpyscipy-with-openblas-for-ubuntu-1204-second-try.html
# do a fresh install of 12.04.3 LTS, then in a temp dir:
# OS
sudo apt-get install build-essential gfortran
sudo apt-get install git curl vim
# Python
sudo apt-get install python-dev python-pip
sudo pip install cython
sudo pip install nose
# OpenBLAS
git clone git://github.com/xianyi/OpenBLAS
pushd OpenBLAS
make FC=gfortran
sudo make PREFIX=/usr/local/ install
popd
# Numpy
git clone https://github.com/numpy/numpy
pushd numpy
vim site.cfg:
#
[default]
library_dirs = /usr/local/lib
[atlas]
atlas_libs = openblas
library_dirs = /usr/local/lib
[lapack]
lapack_libs = openblas
library_dirs = /usr/local/lib
#
export BLAS=/usr/local/lib/libopenblas.a
export LAPACK=/usr/local/lib/libopenblas.a
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
python setup.py build
# verify existence of build/lib.*/numpy/core/_dotblas.so
# run test_numpy.py
sudo python setup.py install
popd
# Scipy
git clone https://github.com/scipy/scipy
pushd scipy
python setup.py build
sudo BLAS=/usr/local/lib/libopenblas.a LAPACK=/usr/local/lib/libopenblas.a LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/ python setup.py install
# run test_scipy.py
popd
# Matplotlib
sudo apt-get install libfreetype6-dev libpng12-dev
git clone git://github.com/matplotlib/matplotlib.git
pushd matplotlib
python setup.py build
sudo python setup.py install
popd
# run unit tests
python -c "import numpy; numpy.test(verbose=2)"
python -c "import scipy; scipy.test(verbose=2)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment