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!
To set up the static IP, I basically followed these directions.
I have a Netgear router so I just logged in at routerlogin.net, 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.
- Set up a profile for the server:
$ipython profile create nbserver
- Create a password hash in python:
from IPython.lib import passwd
- Configure notebook server (change stuff in
c = get_config()
c.IPKernelApp.pylab = ‘inline’
c.NotebookApp.ip = ‘*’
c.NotebookApp.open_browser = False
c.NotebookApp.password = u’hash’
c.NotebookApp.port = 9999
- 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.