How to edit and view jupyter notebooks in remote servers locally using ssh

  1. Install jupyter notebook in the remote machine:
    pip install jupyter
  2. Run jupyter notebook without opening a browser in the remote machine:
    jupyter notebook --no-browser --port=8020
  3. In case you are running Jupyter on a remote node (say node207 In cluster), tunnel the port to the head node, like:
    ssh -N -f -L 8020:localhost:8020 node207
  4. In the local machine, create a tunnel to remote port 8020
    ssh -N -f -L 8020:localhost:8020 user@remote_machine
  5. Open  http://localhost:8082/  in your browser.
  6. Done! Go sip some tea!

Extra Remarks

I experienced an issue where I got the error “typeError: __init__() got an unexpected keyword argument ‘io_loop”.  This can be solved by removing the “io_loop” argument from your “<python installation>/python2.7/site-packages/notebook/base/zmqhandlers.py” file.

 

 

Leave a comment