Skip to content

Instantly share code, notes, and snippets.

@fonnesbeck
Created May 16, 2014 04:10
Show Gist options
  • Save fonnesbeck/cb3546fd45cb516eaa6b to your computer and use it in GitHub Desktop.
Save fonnesbeck/cb3546fd45cb516eaa6b to your computer and use it in GitHub Desktop.
Script to install Python scientific stack ("Scipy Superpack") using Homebrew and pip. Uses Homebrew's Python 2.7.6. Please report any issues in the comments.
#!/bin/sh
hash brew &> /dev/null
if [ $? -eq 1 ]; then
echo 'Installing Homebrew ...'
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
fi
# Ensure Homebrew formulae are updated
brew update
hash git &> /dev/null
if [ $? -eq 1 ]; then
echo 'Installing Git ...'
brew install git
fi
# Add science tap
brew tap homebrew/science
# Python tools and utilities
brew install python
brew install gfortran
pip install nose
pip install six
pip install patsy
pip install pygments
pip install sphinx
pip install cython
# IPython
brew install zeromq
pip install jinja2
pip install tornado
pip install pyzmq
pip install ipython
# OpenBLAS for NumPy/SciPy
brew install openblas
export BLAS=/usr/local/opt/openblas/lib/libopenblas.a
export LAPACK=/usr/local/opt/openblas/lib/libopenblas.a
# Build from cloned repo to avoid SciPy build issue
git clone [email protected]:numpy/numpy.git numpy_temp
cd numpy_temp
python setupegg.py bdist_egg
easy_install dist/*egg
cd ..
rm -rf numpy_temp
# SciPy
pip install git+git://github.com/scipy/scipy#egg=scipy-dev
# Matplotlib
brew install freetype
pip install git+git://github.com/matplotlib/matplotlib.git
# Rest of the stack
pip install git+git://github.com/pydata/pandas.git
pip install git+git://github.com/scikit-learn/scikit-learn.git
pip install git+git://github.com/pymc-devs/[email protected]
pip install git+git://github.com/statsmodels/statsmodels.git
pip install git+git://github.com/Theano/Theano.git
@ahmadia
Copy link

ahmadia commented May 16, 2014

Very nice. Just a piece of unsolicited advice :)

Instead of tracking the master branch of all of these repositories, you should grab specific tags/commits. This reduces the chances that you'll end up with a bug in your stack that is impossible to track down because it could be coming from project X, Y, or Z.

Also, you should check out hashstack, we can handle a reproducible, versioned install profile like this in a similar amount of code (or less). I haven't put together an isolated SciPy stack, yet, but I'd be happy to do so if it would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment