Jupyter notebooks on the iPad Pro

Blake Shaw
4 min readMar 13, 2019

--

tl;dr this post explains how to setup a good Jupyter + Tensorflow development environment running on the iPad w/ AWS

Is the best computer the one you have on you? This is the question that I’ve been asking myself more often since I got an iPad Pro w/ keyboard case. It’s lightweight and has great battery life with cellular connectivity so I carry it often. I find myself doing more and more work on the iPad, but one area stuck out where I still need to use a Mac: any development work I do building ML systems or exploring data. While I don’t anticipate being able to use the iPad for everything in this regard, I wanted to be able to run Python notebooks, and use frameworks like Tensorflow on the go. The resources for doing so were pretty scattered and there were some pitfalls so I took the time to document the setup. If you have any tips or suggestions after reading, please send my way!

Update Feb 2020: Now with iOS 13 Google Colab is better supported in Safari and is an OK option if you don’t need more control over the server you’re connecting to (e.g. SSH access) and can tolerate some keyboard shortcut issues. Read on if you want something more customizable.

Stuff you need to buy

Setup

  • Spin up a virtual machine on Amazon EC2. I chose a p2.xlarge (it has GPUs and lots of ram which is useful for working with data) with their Deep Learning AMI. It’s about a dollar an hour, and you can spin it up and down pretty quickly. This AMI comes with all of the major deep learning packages pre-installed.
  • Make sure to adjust the security group to open port 8.8.8.8 as a custom TCP rule (so that we can later setup a reverse SSH tunnel of that port to localhost on the iPad)
  • Generate a new private key for AWS and add to Blink app as well as SSH Tunnel app, the user is ec2-user, and the hostname is accessible from the AWS console
  • Setup the Jupyter config (note we aren’t going to use SSL) as described here — so do the bit about generating a password, but don’t bother with the SSL certs.

To Run

When you spin up your instance (via the AWS web interface):

  • Update Blink and SSH Tunnel with the hostname for the new instance
  • Start the notebook server: jupyter notebook —nobrowser —port 8888 I suggest running this in a screen so you can close the shell and forget about it. You can also add this as a command to be executed on startup for the instance.
  • Start the SSH Tunnel app
  • Open Juno (and connect to localhost port 8888)
  • To shutdown when you’re done, use the AWS web interface to stop the instance, note this will keep around your data in an EBS volume

Other notes

  • I would have loved to use Google Colaboratory for this, but unfortunately their iPad support is really rough — almost unusable due to the way text fields render and keyboard shortcuts work. Update Feb 2020: this is way better now — totally usable!
  • I first tried to get Juno working with self-signed SSL certificate s— this works! But the issue is that if you want to spin up and down different machines you have to regenerate and redownload certificates, its much messier than just updating two hostnames in two apps and issuing a shell command. I wouldn’t recommend this route unless you know you’ll leave the machine spun up with the same domain name. More info here.
  • While the Deep Learning AMI does not work on the free tier for AWS, you can setup a t2.micro (which is free), and install anaconda if you want persistent access to a free machine for running simple notebooks (note there is not much ram, disk space or GPU on the free tier)

Resources

--

--

Blake Shaw

Engineering manager at Facebook, prev head of data science at Foursquare. Interests: machine learning, visualization, computational photography, snowboarding