My current iPython research setup

This is a summary of how I’ve setup my ipython research environment on a Debian Squeeze computer (the MakeHackVoid Sun computer (Morphia) mentioned in my earlier post)

Using virtualenvwrapper lets me setup different python workspaces without changing the default environment for anyone else using the computer.

I’m running mySQL, Solr and iPython on the remote computer and using the iPython notebook in my local browser via a ssh tunnel.

Install all the system support libraries

These are required by the python modules I install below. If you remove some of the modules, you may not need all of these support libraries.

Install ZeroMQ

iPython needs ZeroMQ for notebooks.

Install virtualenv and virtualenvwrapper

Not sure if these steps are necessary because I went back and forward trying different approaches:

Uninstall debian squeeze default virtualenvwrapper as it is old:

Make sure to delete /etc/bash_completion.d/virtualenvwrapper which is from the original debian install of virtualenvwrapper. It is not removed when you unistall virtualenvwrapper from debian.


to install the latest version.

Add lines to your .bashrc to define where the virtual environments should be

I also created the Devel directory, although I’m not sure if that was necessary.

Install ipython in virtual environment

Create a virtual environment and install ipython and all of the modules I’m using
into it. You may not want all of these modules.

Although I’m now using sunburnt, some of my earlier tests use solrpy so install that too:

Updating to development version of ipython

Copy the base setup so can go back to it:

This will not copy the working directory under

Upgrade to the most recent pip in the virtual environment

For me this changed pip from 0.7.2 to 1.1
New version doesn’t use the -E option anymore. So just use:

Setup virtual environment for every login

I added: workon brendatest to the bottom of my .bashrc file so the brendatest environment is always activated when I log in directly.


As well as putting my database into mySQL on morphia, I need to add a readonly user matching that defined in the Solr db-data-config.xml on morphia for solr access to the mySQL database. I also need to add a user on morphia with a password to give iPython programs access to database.

Remote iPython access

Having finished setting up ipython, it is possible to run it in a ssh terminal window, but it is using the w3m browser. I want to view it in chrome on my local computer instead. So I’ve written some scripts to do this. At the server end I have have a script to start solr:

and one to start iPython notebook.

Because using -t with ssh doesn’t load your user profile (.bash_rc for me), need to set up the virtualenvwrapper environment in this script.

Then I have a startup and shutdown script on my macbookpro. I’m using certificate authentication for ssh, so my ssh commands don’t have any password information.

Replacein the scripts below with your username and remote computer url for ssh. For example

The startup script sets up the port redirection for ipython notebook, start solr and ipython remotely and then start chrome with the ipython notebook index page.

The shutdown script relies on the fact that I don’t have anything else running on morphia. This is probably not the best approach.

I’d like to find a way to have the shutdown happen automatically when I close the terminal window that the startup script has run in (or maybe a way of having the startup script wait to be told to quit?)

  1. Hmm, useful setup. I think I’ll try to duplicate this on an EC2 instance and see how that goes.

  2. I’d be interested to hear how that goes.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.