Thursday, May 23, 2013

Easy way of installing Python and scientific packages for OS X (non-academic users): Anaconda

Introduction

Mac OS X users know that getting python and its scientific packages (numpy, scipy, ipython etc) installed properly can be a tricky job.

If you are affiliated with a university, you can try the freely available and easy to install Enthought distribution (if you are not affiliated with a university, you can still get the Enthought dsitribution for free but you are stuck with 32 bits binaries).

One way of getting things installed properly (even if you are not affiliated with a university) is by using the native OS X python interpreter and installing everything via pip as I describe in this post. This method is a little tricky but works well for me. One advantage is that it is easy to install new packages in this way: just use pip.

Another way is using macports. This is relatively straightforward, but can take a long time to compile all the dependencies (hours) and, worse of all, can potentially create conflicts between different libraries and different python interpreters.

Anaconda

I recently came across an easy way of getting python and the scientific packages installed. It also provides a convenient framework for installing extra packages. This is the Anaconda python distribution provided by Continuum Analytics. Anaconda provides the most popular packages: numpy, scipy, ipython (+notebook) and even more - astropy, spyder, pandas etc. And 64 bits binaries! For everybody. For free.

How to install it? 

Pretty easy. Go to the downloads page. Download the installer for your operating system. After downloading the file, for OS X you just need to issue the command

 sh <downloaded file.sh>  

Piece of cake. You can choose to let the installer change your PATH variable. After that, when you invoke python or ipython, it will automatically call the appropriate binaries and you will have available all the important packages.

To install additional packages, you can use their conda package manager or the usual pip.

No comments:

Post a Comment