Jupyter on GCE

I was recently inspired to setup Jupyter to run remotely on a GCE instance. I have access to a lot of computing resources for work, so it’s silly to run things on locally my laptop, but running interactive Python sessions remotely can be painful due to latency and the vagaries of terminals. Running Jupyter seems like a perfect fit here, since the editing is done locally – no lag – and Jupyter can be nicely self documenting for moderate sized projects1)Once projects hit a certain size though, Jupyter becomes inscrutable and really needs to be modularized.

Jeff Delaney has a helpful post on setting Jupyter up GCE and the Jupyter docs on running a public server also have some useful information. However, the solutions for exposing Jupyter to the web were not terribly secure or painful to implement, or both. Since I’m only interested in being able to run the server myself, a simple, relatively secure solution is to use ssh tunneling. So rather than exposing ports publicly on GCE, just start the Jupyter server on your GCE instance with the –no-browser option.

jupyter notebook --no-browser

Then, on your local machine run

gcloud compute ssh nnet-inference \
                       --ssh-flag="-L" \
                       --ssh-flag="9999:localhost:8888"

And point your browser to http://localhost:9999.

That’s it. Now you can use Jupyter remotely without opening up public ports on your GCE instance.  2)A couple of minor notes: I run my notebook inside tmux so that it stays alive if my connection drops. And if the connection drops you’ll need to restart the tunnel.

References   [ + ]

1. Once projects hit a certain size though, Jupyter becomes inscrutable and really needs to be modularized.
2. A couple of minor notes: I run my notebook inside tmux so that it stays alive if my connection drops. And if the connection drops you’ll need to restart the tunnel.

MIA

I’ve been too busy trying to classify fishing vessels for Global Fishing Watch to post lately, but I’m hoping that I’ll have a bit more time now.

A Connection Between RMSPE and the Log Transform

Frequency Content of a Jittered Step

Signal Jitter and Averaging

I’m sure this information must be out there somewhere, but since I had a hard time finding it I figured I’d write it up in the hope that it’s useful for someone.

This is (mostly) a Test

The primary purpose of this post is to test using IPython notebooks as part of WordPress blog posts. I already did a some testing of this (see my previous post), but figured more couldn’t hurt. If someone finds it interesting, so much the better.

We transition from regular WordPress to a notebook just below:

IPython Notebooks in WordPress