Virtues of Virtualenv

on a clean mac

sudo easy_install pip

sudo pip install virtualenv

USAGE

Let’s say you have a directory called myproject. Setup virtualenv for that project.

$ cd myproject

$ virtualenv venv

If you want your virtualenv to also inherit globally installed packages (like iPhython or Numpy) run:

$ virtualenv venv –system-site-packages

Once venv subdirectory is created you need to activate it.

$ source venv/bin/activate

You should see (venv) appear at the start of your terminal prompt

you can now install packages

$ pip install <package>

to leave virtual env

$ deactivate

 

Advertisements

matplotlib on mavericks is a mess

pylab needs matplotlib

On mavericks, first install freetype using brew ‘brew install freetype’

Then install xquartz

then install matplotlib (with the compiler flag from previous posts).

 

The order that worked for me was to fail installing matplotlib, fail installing freetype, then get xquartz installed, reinstall freetype (and try a couple of times) and then it finally succeeded!!

compile errors with xcode versions

Installing numpy fails due to an xcode compiler flag mismatch error, well documented on stackoverflow. Here’s how I installed scikit

 

mkdir SGML

cd SGML

virtualenv venv

source venv/bin/activate

($venv) sudo ARCHFLAGS=-Wnoerror=unusedcommandlineargumentharderrorinfuture pip install upgrade numpy

numpy is required for scikit

($venv) sudo ARCHFLAGS=-Wnoerror=unusedcommandlineargumentharderrorinfuture pip install upgrade scikit-learn

the actual package is called scikit-learn

($venv) sudo ARCHFLAGS=-Wnoerror=unusedcommandlineargumentharderrorinfuture pip install upgrade pandas

install pandas for good measure

ipython (which requires a bunch of dependencies)

Finally, scipy — which will require fortran compiler for which you need to ‘brew install gfortran’