on a clean mac
sudo easy_install pip
sudo pip install virtualenv
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
A great visual by Swami Chandrasakeran on navigating subways to data science competency.
A data scientist’s journey
Original post here
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!!
Installing numpy fails due to an xcode compiler flag mismatch error, well documented on stackoverflow. Here’s how I installed scikit
($venv) sudo ARCHFLAGS=-Wno–error=unused–command–line–argument–hard–error–in–future pip install —upgrade numpy
numpy is required for scikit
($venv) sudo ARCHFLAGS=-Wno–error=unused–command–line–argument–hard–error–in–future pip install —upgrade scikit-learn
the actual package is called scikit-learn
($venv) sudo ARCHFLAGS=-Wno–error=unused–command–line–argument–hard–error–in–future 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’