Skip to content

Commit

Permalink
First homebrew-based script
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Fonnesbeck committed Oct 16, 2014
1 parent a29edf0 commit 0479727
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 101 deletions.
12 changes: 6 additions & 6 deletions README.md
@@ -1,24 +1,24 @@
# Scipy Superpack
# Scipy Superpack for Homebrew

## Recent builds of fundamental Python scientific computing packages for OS X

This shell script will install recent 64-bit builds of [Numpy](https://github.com/numpy/numpy) (1.8) and [Scipy](https://github.com/scipy/scipy) (0.13), [Matplotlib](https://github.com/matplotlib/matplotlib) (1.4), [IPython](https://github.com/ipython/ipython) (1.0), [Pandas](https://github.com/pydata/pandas) (0.12), [Statsmodels](https://github.com/statsmodels/statsmodels) (0.5.0), [Scikit-Learn](https://github.com/scikit-learn/scikit-learn) (0.14), and [PyMC](https://github.com/pymc-devs/pymc) (2.2 alpha) for OS X 10.9 (Lion) on Intel Macintosh. All builds are based on recent development code from each package, which means though some bugs may be fixed and features added, they also may be more unstable than the official releases. Distributing them together should improve interoperability, since the supporting packages (Scipy, Matplotlib, PyMC) were all built against the accompanying build of Numpy. These packages were compiled on OS X 10.9 using Apple’s Python 2.7.5, gFortran 4.2.4 and GCC 4.2.1. To avoid compatibility issues, the installer also optionally downloads and installs the gFortran compiler that is compatible with Xcode 4.2. Before you install the Superpack, ensure that Xcode command line tools are installed on your system.
This shell script will build and install the Python scientific stack, including [Numpy](https://github.com/numpy/numpy), [Scipy](https://github.com/scipy/scipy), [Matplotlib](https://github.com/matplotlib/matplotlib), [IPython](https://github.com/ipython/ipython), [Pandas](https://github.com/pydata/pandas), [Statsmodels](https://github.com/statsmodels/statsmodels), [Scikit-Learn](https://github.com/scikit-learn/scikit-learn), and [PyMC](https://github.com/pymc-devs/pymc) for OS X 10.10 (Yosemite) using the [Homebrew](http://brew.sh) package manager. The script will use recent development code from each package, which means that though some bugs may be fixed and features added, they also may be more unstable than the official releases.

Caveat emptor: These builds contain development (i.e. pre-release) code that may not be free of critical bugs. I encourage all users to run the appropriate unit tests on each package to ensure that any extant issues do not affect your work. Please report any errors that may be the result of build issues.
The SuperPack will install Python 2.7.6 from Homebrew and build all packages against it.

### Dependencies

OS X 10.9 (Mavericks), Python 2.7.5, Xcode 5.1 command line tools
OS X 10.10 (Yosemite)

### Install

[Download Scipy Superpack Installer for OSX 10.7](https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh)
[Download Scipy Superpack Installer for OSX 10.10](https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh)

To install, open a terminal in the directory that the script is located and call:

> sh install_superpack.sh
You will be prompted for your administrator password. If you have already installed the current gFortran, you can bypass that package during the install process. Similarly, the installation requires Git, so you will be prompted to install it if you are installing remotely.
If you have not already installed the current Homebrew, Git, and the Xcode command line tools, these will be installed for you.

### Contact

Expand Down
153 changes: 58 additions & 95 deletions install_superpack.sh
@@ -1,109 +1,72 @@
#!/bin/sh
PYTHON='/usr/bin/python'
GIT_FILENAME='git-1.7.7.3-intel-universal-snow-leopard'
GIT_VOLUME='/Volumes/Git 1.7.7.3 Snow Leopard Intel Universal/'
GFORTRAN='gcc-42-5666.3-darwin11.pkg'
SUDO='sudo'
BRANCH='master'

if [ -z "$VIRTUAL_ENV" ]; then
# Standard Python env
PYTHON=/usr/bin/python
SUDO=${SUDO}
else
# Virtualenv
PYTHON=python
SUDO="" #${SUDO} is not required in a virtualenv
hash brew &> /dev/null
if [ $? -eq 1 ]; then
echo 'Installing Homebrew ...'
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
fi

if [ -d ".git" ]; then
# Ensure Homebrew formulae are updated
brew update

SUPERPACK_PATH='.'
hash git &> /dev/null
if [ $? -eq 1 ]; then
echo 'Installing Git ...'
brew install git
fi

else
hash gcc &> /dev/null
if [ $? -eq 1 ]; then
echo 'No gcc detected; Installing XCode Command Line Tools ...'
xcode-select --install
fi

SUPERPACK_PATH='ScipySuperpack'
# Add science tap
brew tap homebrew/science

hash git &> /dev/null
if [ $? -eq 1 ]; then
hash brew &> /dev/null
if [ $? -eq 1 ]; then
echo 'Downloading Git for OS X ...'
curl -o ${GIT_FILENAME}.dmg http://git-osx-installer.googlecode.com/files/${GIT_FILENAME}.dmg
echo 'Installing Git ...'
hdiutil mount ${GIT_FILENAME}.dmg
${SUDO} installer -pkg "${GIT_VOLUME}${GIT_FILENAME}.pkg" -target '/'
hdiutil unmount "${GIT_VOLUME}"
echo 'Cleaning up'
rm ${GIT_FILENAME}.dmg
echo 'Cloning Scipy Superpack'
/usr/local/git/bin/git clone --depth=1 git://github.com/fonnesbeck/ScipySuperpack.git
else
brew install git
echo 'Cloning Scipy Superpack'
git clone --depth=1 git://github.com/fonnesbeck/ScipySuperpack.git
fi
else
echo 'Cloning Scipy Superpack'
git clone --depth=1 git://github.com/fonnesbeck/ScipySuperpack.git
fi
# Python tools and utilities
brew install python
brew install gcc
pip install -U nose
pip install -U six
pip install -U patsy
pip install -U pygments
pip install -U sphinx
pip install -U cython

cd ${SUPERPACK_PATH}
git checkout "${BRANCH}"
cd ..
fi
# IPython
brew install zeromq
pip install -U jinja2
pip install -U tornado
pip install -U pyzmq
pip install -U git+git://github.com/ipython/ipython.git

hash brew &> /dev/null
if [ $? -eq 1 ]; then
echo 'Downloading gFortran ...'
curl -o ${GFORTRAN} http://r.research.att.com/tools/${GFORTRAN}
echo 'Installing gFortran ...'
${SUDO} installer -pkg ${GFORTRAN} -target '/'
else
brew install gcc
fi
# 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

hash easy_install &> /dev/null
if [ $? -eq 1 ]; then
echo 'Downloading ez_setup ...'
curl -o ez_setup.py http://peak.telecommunity.com/dist/ez_setup.py
echo 'Installing ez_setup ...'
${SUDO} "${PYTHON}" ez_setup.py
rm ez_setup.py
fi
# Build from cloned repo to avoid SciPy build issue
git clone git@github.com:numpy/numpy.git numpy_temp
cd numpy_temp
python setupegg.py bdist_egg
easy_install dist/*egg
cd ..
rm -rf numpy_temp

echo 'Installing Scipy Superpack ...'
${SUDO} "${PYTHON}" -m easy_install -N -Z ${SUPERPACK_PATH}/*.egg
# SciPy
pip install -U git+git://github.com/scipy/scipy#egg=scipy-dev

echo 'Installing readline ...'
${SUDO} "${PYTHON}" -m easy_install -N -Z readline
echo 'Installing nose ...'
${SUDO} "${PYTHON}" -m easy_install -N -Z nose
echo 'Installing six'
${SUDO} "${PYTHON}" -m easy_install -N -Z six
echo 'Installing pyparsing'
${SUDO} "${PYTHON}" -m easy_install -N -Z pyparsing==1.5.7
echo 'Installing python-dateutil'
${SUDO} "${PYTHON}" -m easy_install -N -Z python-dateutil
echo 'Installing pytz'
${SUDO} "${PYTHON}" -m easy_install -N -Z pytz
echo 'Installing Tornado'
${SUDO} "${PYTHON}" -m easy_install -N -Z tornado==3.1.1
echo 'Installing pyzmq'
${SUDO} "${PYTHON}" -m easy_install -N -Z pyzmq
echo 'Installing pika'
${SUDO} "${PYTHON}" -m easy_install -N -Z pika
echo 'Installing jinja2'
${SUDO} "${PYTHON}" -m easy_install jinja2
echo 'Installing patsy'
${SUDO} "${PYTHON}" -m easy_install -N -Z patsy
echo 'Installing pygments'
${SUDO} "${PYTHON}" -m easy_install -N -Z pygments
echo 'Installing sphinx'
${SUDO} "${PYTHON}" -m easy_install -N -Z sphinx
if [ ! -d ".git" ]; then
echo 'Cleaning up'
rm -rf ${SUPERPACK_PATH}
fi
# Matplotlib
brew install freetype
pip install -U git+git://github.com/matplotlib/matplotlib.git

# Rest of the stack
pip install -U git+git://github.com/pydata/pandas.git
pip install -U git+git://github.com/scikit-learn/scikit-learn.git
pip install -U git+git://github.com/pymc-devs/pymc.git@2.3
pip install -U git+git://github.com/statsmodels/statsmodels.git
pip install -U git+git://github.com/Theano/Theano.git

echo 'Done'
# Release version of Bokeh
pip install -U bokeh
Binary file removed ipython-2.0.0_dev-py2.7.egg
Binary file not shown.
Binary file removed matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg
Binary file not shown.
Binary file removed numpy-1.9.0.dev_297f54b-py2.7-macosx-10.9-intel.egg
Binary file not shown.
Binary file not shown.
Binary file removed pymc-2.3.2-py2.7-macosx-10.9-intel.egg
Binary file not shown.
Binary file removed scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg
Binary file not shown.
Binary file removed scipy-0.14.0.dev_7cefb25-py2.7-macosx-10.9-intel.egg
Binary file not shown.
Binary file removed statsmodels-0.6.0-py2.7-macosx-10.9-intel.egg
Binary file not shown.

0 comments on commit 0479727

Please sign in to comment.