Remotely accessing a Jupyter notebook

Image of a Green tree python

I was recently in a situation where I needed to remotely access a python notebook. Here’s how I went about doing it, and you can follow the steps it if you find yourself with a similar problem.


The basic scenario is as follows:

  • I want to host a Jupyter notebook on my laptop (Windows 10)
  • I want to access it on a desktop (Windows 7)

There are a number of steps involved here, including setting up the python environment on the host, as well as enabling an SSH server.

Image of a Green tree python
Image by Keith Hooks (Geekly at English Wikipedia)

Install Python & Notebooks

The first stage is on the Windows 10 Laptop, to prepare python:

  1. Install python: I use a clean install from (you could use a pre-populated environment like anaconda, if you want less work) which includes pip. Just download and run the installer – I recommend the latest version of the python 3 branch.
  2. Press Windows Key+X, and open a new “PowerShell” prompt. Then type python and if everything set up properly, then you should see a python interactive console
    1. If you get a “command not found” error, then python didn’t get added to the PATH properly.
    2. Press Windows Key+R, and type SystemPropertiesAdvanced, then click “Environment Variables”.
    3. Select the user (top half) variable for “Path”, Edit, and browse to add the folder that contains your newly installed python.exe
  3. (Optional) Set up a python virtual environment – I prefer these to system wide installs like anaconda uses, just because it makes it a bit less messy when installing packages.
    1. First you need to add the virtualenv package – from a PowerShell prompt, type pip install virtualenv
    2. Important note: Don’t create a virtual environment that at any point includes spaces, hyphens or other possibly suspect characters. For some reason python / pip doesn’t like that.
    3. Create the virtual environment with the command python -m virtualenv jupyterenv
    4. Start the virtual environment with the command: .\jupyterenv\Scripts\activate.ps1
  4. Install the jupyter package with the command:
    pip install jupyter pandas numpy scipy

    (You can add any additional packages you need to that last line)
  5. Start the notebook to make sure everything worked: jupyter notebook --nobrowser
  6. Make a note of the localhost URL that is generated, as stated on the command line

Enable SSH Server

The next step is to allow the use of an SSH server on the Windows 10 Laptop:

  1. Press Windows Key+R and type ms-settings:optionalfeatures
  2. If you don’t already have it available, click “Add a feature” and install both of the OpenSSH components
  3. Press Windows Key+X, and open a new “PowerShell (Admin)” prompt. Then run the command Start-Service -Name "sshd"
  4. Use the command ipconfig and make a note of the IPv4 address for your internet connection (there may be more than one – make sure to select correctly)

Enable the SSH Client

On the Windows 7 Machine, start a connection over SSH. Unfortunately, Windows 7 doesn’t have native SSH software, so you’ll need to work around this limitation:

  1. For SSH on Windows 7, I use PuTTY, which can be installed from here
  2. Open up PuTTY, and prepare to add some new session info
  3. In ☰ Session, add the IPv4 address of the laptop to “Host Name”
  4. In ☰ Connection > SSH > Tunnels, Under “Source Port”, put the port that you want to use on the windows 7 machine. For simplicity I suggest using the same port as from the localhost URL. e.g. 8888.
  5. Under “Destination”, put the name and port part of the localhost URL from earlier, including the port. e.g. localhost:8888
  6. Click “Add”
  7. In ☰ Session, enter a name in the “Saved Sessions” box and click “Save”, so it is remembered for next time

Start working!

On the Windows 7 Machine, load the notebook:

  1. In PuTTY, select your saved session and then click “Load”
  2. Click “Open” to start the SSH session
  3. Enter the username and password for the laptop when prompted
  4. In Vivaldi (or your web browser of choice), enter the localhost URL for the notebook as stated on the command line of the laptop
  5. Load the webpage
  6. Either open up your python notebook, or create a new one

Join the Conversation

  1. In my office, we run a (small) jupyter notebook on a server, where all the files are synced using dropbox. We should make the switch to JupyterLab. Being able to have your code, tests, comments, results and documentation all in one place is really a blessing!


Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.