Python/PyMC Setup

Here are some notes on getting and learning Python.

Getting:

For Windows: The Enthought Python Distribution is free for “educational users at degree-granting institutions”. It includes numpy, scipy, and matplotlib. Go to the Enthought Download Page and get it if you are eligible. Install it by double-clicking and then clicking ‘Ok’ until it stops asking for approval. Then download and install the PyMC windows installer from the PyMC Downloads Page. Alternative approach: get packages you need individually here.

For Ubuntu or Debian: Type the following into a terminal:

sudo apt-get install ipython python-setuptools python-dev python-nose python-tk python-numpy python-matplotlib python-scipy python-networkx gfortran libatlas-base-dev
sudo easy_install pymc

Testing:

Type ipython --pylab to start interactive python, or find the icon in the start menu. To make PyMC run its self-tests, do this:

import numpy
numpy.test()
import pymc
pymc.test()

Hmm, my PyMC doesn’t have any tests…

Learning

:

To quickly get going in Python read this and this:

If you have used Matlab before then skim this:

Other resources:

7 responses to “Python/PyMC Setup

  1. Kyle

    Other resources that I’ve found useful:

    SciPy 2010 intro tutorial slides: http://conference.scipy.org/scipy2010/misc/intro_tutor_data.zip

    A Primer on Scientific Programming with Python:
    Book: http://www.springerlink.com/content/978-3-642-02474-0
    Slides (the page is in Norwegian, but the slides aka ‘foils’ are in English): http://www.ifi.uio.no/~inf1100/foiler/

  2. Python and a number of other wonderful things for scientists to know about software engineering: http://software-carpentry.org/

  3. I tried the instructions you gave for pymc installation, and easy_install failed with “No module named numpy.distutils.misc_util”. But when I tried pip, it worked fine.

  4. Thanks for this fix, Gary. Scientific python packaging has shifted since I wrote these notes. I think pip is generally preferred to easy_install now. Also, I’ve had great results with anaconda lately.

  5. To install on 64-bit windows 8.1, I’ve had success with this: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pymc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s