Connecting to a Remote Jupyter Notebook Session

Tags linux mac

Summary

To run Jupyter Notebook on a remote Linux machine so you can access the notebook from your Mac's browser you will need to follow these steps. (Your Anaconda environment should already be initialized for your user account.)

Environment

  •  macOS, Linux, Anaconda python - Jupyter Notebook

Directions

  1. Open a terminal window on your Mac, and enter this command to connect through a forwarded port where the notebook will be told to run:

$ ssh -L 8888:localhost:8888 uniqname@machinename.dept.lsa.umich.edu

  1. Enter your password to login as usual
  2. Now that you are logged in to the Linux machine, type the command (note 8888 is the default port for Jupyter notebook) :

$ jupyter notebook --no-browser --port=8888

  1. This command will give you the URL link that you'll need for your local machine's browser. So from your terminal, copy either link that starts with

http://localhost:8888/?token=somelongseriesofnumbersandletters
or
http://127.0.0.1:8888/?token=somelongseriesofnumbersandletters

  1. Make sure you copy the whole token in the URL, which is the long series of letters and numbers. Then on your local Mac, open your browser of choice, and then paste in the address and browse to that site.
  2. When you are done using the notebook, you can click the quit button at the top of the notebook site, which will close out the Jupyter Notebook that is running, or you can enter <CTRL><c> in your terminal window which will shut down the server as well.

External resources

Print Article

Details

Article ID: 9458
Created
Mon 12/19/22 3:01 PM
Modified
Thu 9/5/24 9:13 AM