ipython notebooks

ipython notebooks are a useful way to run/save a session of python code/analysis. I can see it as a useful way to share code and promote reproducible research. In several respects, its similar to knitr in R except that it runs in your browser.

I’ve been using ipython notebook on our cluster, which turns out to be fairly easy. You really need a few things:

Server Side

  • IP address of a machine on the cluster
  • port (of your choosing) on that machine

Typically, I log on into our system and qlogin or ssh onto a node where I know the IP address and then run

This will start up ipython notebook on that node.

Client Side (Windows)

Then from my laptop, I tunnel into the cluster node using Putty for SSH. I ssh into the cluster and then use a SSH tunnel for port forwarding. So under SSH Tunnels

Source port: 8888 (for example)

Destination: 10.1.2.3:8888 (for example)

Now I open my browser and point it to:

http://localhost:8888

and i will have a ipython notebook session! One thing to note is that whatever directory on the server that you start up ipython notebook is the directory where your notebooks will be saved (by default). I actually have a jupyter (the new name for ipython notebooks I guess) directory in my home folder where I keep my ipython notebooks but you can imagine putting them on git and doing pull requests, etc.