How to use a Jupyter Notebook running on a remote Linux Machine on your local Windows Machine


(Will) #1

I know different versions of this are covered in the paperspace set-up instructions and AWS instructions but neither of them directly addressed the use case I had in mind.

Basically, because pytorch and therefore fast.ai v1 are only supported on Linux for the moment, I wanted to figure out a way to start exploring the library and the differences from the prior incarnation of Fast.ai before Fast.ai Live classes start. I already had a windows 10 box with a GPU built so I didn’t want to pay for a cloud computing service. So I ended up setting up a dual boot on my windows machine by installing an Ubunutu 18.04 partition and the Cuda drivers + Anaconda on that partition The problem was my primary method of accessing this machine when booted into Windows was Remote desktop which worked great, but when using Xrdp to remote into the Ubuntu machine the performance was unusably slow. So I needed a solution which is where I remember it’s possible to run Jupyter Notebook in your local browser that’s running on a remote computer.

So after that long rambling motivating explanation, here’s all you have to do. (note, I’m assuming you’ve already installed all the software and packages you needed to on your remote computer, especially fast.ai!) :

  1. SSH into your remote computer from your local computer. To do this I ran putty on windows on my local laptop. You need to know the ip address of your remote machine for this, and that’s usually it.

  2. The putty secure shell asks for your username and password, these are for the remote computer.

  3. In the putty terminal run:

jupyter notebook --no-browser --port=8080

you can pick a different port if you like, in my case i was already using port 8080 so Jupyter automatically picked another port: 8081. Just make sure you note this in the terminal output.

  1. From a new anaconda terminal on your local windows laptop run, (note that i had to use the new port that Jupyter picked automatically even though I entered port 8080 above:

ssh -L 8081:localhost:8081 <remote_username>@<remote_ip_address>

  1. You’ll be asked for your password one more time and you’re good to go. Just go to: http://localhost:8081/ or whatever port you’re using on your local laptop and you’re good to go! You may need to enter the token that is added on to the end of your local host link, but it’s pretty self explanatory on jupyter.

Hope this helps some other people get configured. I’m pretty much a total noob to ssh and linux and so this took me quite a long time to figure out, so hopefully, this post means you won’t have to burn that time as well.