Remote IPython notebook with Raspberry Pi

It recently stuck me that I’d really like to do some data analysis on my iPhone. This is pretty impractical because it’s a tiny screen and the keyboard often autocorrects and capitalizes things I don’t want it to, but I still wanted to do it because 1) I can, and 2) why not?.

To do this, I connected my Raspberry Pi up to the router, created a static IP address, set my router to port forward to that IP address, installed IPython and its friends, and set up a remote notebook. Pretty simple stuff!

Static IP

To set up the static IP, I basically followed these directions.

Port forwarding

I have a Netgear router so I just logged in at, went to port forwarding, and forwarded to my Raspberry Pi’s static IP address at port 9999.

Installing IPython and friends

Since I’m using Raspbian, it’s as easy as:

$sudo apt-get -y install ipython-notebook
$sudo apt-get -y install python-matplotlib python-scipy \
python-pandas python-sympy python-nose

(copied from the IPython install guide)

Setting up a remote notebook

Setting up a remote notebook involved following these instructions.

  1. Set up a profile for the server:

$ipython profile create nbserver

  1. Create a password hash in python:

from IPython.lib import passwd

  1. Configure notebook server (change stuff in /home/user/.ipython/profile_nbserver/

c = get_config()

Kernel config

c.IPKernelApp.pylab = ‘inline’

Notebook config

c.NotebookApp.ip = ‘*’
c.NotebookApp.open_browser = False
c.NotebookApp.password = u’hash’
c.NotebookApp.port = 9999

  1. Then to start the server:

ipython notebook –profile=nbserver

The directions are explained much better at the link. But now, I just point my iPhone’s browser at my IP address, and BOOM! I’m ready to be distracted in class.

I also added the line to start up notebooks into rc.local file located /etc/rc.local so that the notebook server starts up each time I log in.
Now scientific computing on a 700 MHz CPU is not ideal, so next I’m going to figure out how to create a cluster of Raspberry Pis, but that will likely wait until summer.

3 thoughts on “Remote IPython notebook with Raspberry Pi

  1. Pingback: Getting a Raspberry Pi Up and Running | OUseful.Info, the blog...

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s