Python Installation Instructions

This page describes how to install Python and the other packages (Numpy, Scipy, IPython, Matplotlib) required for the course for Mac OS X, Linux and Windows.

Linux

In Linux, the installation instructions are pretty straightforward. Assuming that you are running Debian or Ubuntu, you just need to execute the following command in the terminal:

sudo apt-get install python-numpy python-scipy python-matplotlib ipython-notebook

For Fedora users, you can use the yum tool.

MS Windows

In this case, we recommend downloading and installing the Anaconda Python distribution. The installations instructions are available here.

Just download the installer and execute it.

Anaconda includes most of the packages we will use and it is pretty easy to install additional packages if required.

Mac OS X

If you are a GSFC employee

In this case, we recommend downloading and installing the Anaconda Python distribution. The installations instructions are available here.

Just download the installer and execute it.

Anaconda includes most of the packages we will use and it is pretty easy to install additional packages if required.

If you are not affiliated with an university

This is the case for example for GSFC employees and many GSFC postdocs. In this case, we recommend downloading and installing the Anaconda Python distribution. The installations instructions are available here.

Just download the installer and execute it.

Anaconda includes most of the packages we will use and it is pretty easy to install additional packages if required.

If you are affiliated with an academic institution

Then the easiest way to install Python and the other packages is to request an academic license and download the Enthought Canopy Python distribution. Enthought includes all the packages we will use during the course.

The installation instructions are available here, which has installers for Mac OS X and Windows.

Note that you need the academic license in order to install the 64-bit (recommended) version. The 32-bit version is free for all.

If the above two methods do not work for OS X

The MacPorts way

You can try installing everything using MacPorts. First download and install macports and then issue the following command in a terminal:

sudo port install py27-scipy +gcc47

(the reason to use the ‘variant’ for scipy is that otherwise it will try to build some other version of gcc/gfortran, probably unnecessarily duplicating the compiler and taking a lot longer to build.)

Afterwards, issue the command

sudo port install py27-numpy py27-matplotlib py27-pyfits py27-pywcs py27-ipython py27-pytools py27-pip

and:

sudo port install py27-zmq py27-tornado py27-nose

(the above dependencies are required in order to run IPython notebook.)

Finally, run:

sudo port select --set ipython ipython27

in order to select the MacPorts IPython as the default interpreter.

The advantage of this method is that it easy to do. The downsides: * It can take a couple of hours to finish the installation depending on your machine and internet connection, since macports will download and compile everything as it goes. * If you like having the bleeding edge versions, note that it can take a while for them to be released on macports * Finally, macports can create conflicts between different python interpreters installed in your system

Using Apple’s Python interpreted and pip

If you feel adventurous, you can use Apple’s builtin python interpreter and install everything using pip. Please follow the instructions described in this blog.

If you run into trouble

Feel free to contact us.

Feel free to contact us.

pythonbootcamp@bigbang.gsfc.nasa.gov

Changelog

May 30, 2013: created by Rodrigo Nemmen.

Jun 6, 2013: incorporated MacPorts tricks suggested by David P. Friedlander.