Jupyter Notebooks via tunnelling
Requirements
Instructions
if anaconda not set up on remote machine see information at the bottom of this page
- ssh to machine you want to run notebooks on (needs to have access to data etc) e.g. - ssh foe-linux.leeds.ac.uk
- Once Jupyter is installed via anaconda or other choice generate password - jupyter notebook --generate-config jupyter notebook password 
- Edit the following lines in the config file like this exampele (may require different port number) 
c.NotebookApp.allow_origin = '*'
c.NotebookApp.allow_password_change = False
c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 5566
- start a screen session ideally naming the session something sensible - screen -S JupyterScreen
- go to desired directory and run - jupyter-notebook
- Take Note of port number e.g. 5566 
[I 11:48:41.622 NotebookApp] The Jupyter Notebook is running at:
[I 11:48:41.622 NotebookApp] http://foe-linux-03.leeds.ac.uk:5566/
- detach screen: - ctr+ a+- ctrl +d
- On your home computer (linux or mac) edit or create file - ~/.shh/configto contain the lines (as referenced in our remote access page)
Host remote-access
     User <leeds-user-name>
     ForwardAgent yes
     ForwardX11 yes
     Hostname remote-access.leeds.ac.uk
     IdentityFile ~/.ssh/id_rsa_work
     ServerAliveInterval 240
Host foe-03
     User <leeds-user-name>
     ForwardAgent yes
     ForwardX11 yes
     Hostname foe-linux-03
     IdentityFile ~/.ssh/id_rsa_work
     ServerAliveInterval 240
     Proxycommand ssh -qremote-access -W %h:%p
You need config for a gateway machine: e.g. remote access or see-gw-01 and the machine you are running the notebook on 9. generate key and copy keys to access to leeds systems as outlined in our remote access page
- ssh-keygen -t rsaname something like- id_rsa_workto match identity file in the config file you just created
- ssh-copy-id earhbu@see-gw-01
- Now tunnel in 
- generic - ssh -N -f -L localhost:<localportno>:localhost:<remoteportno> user@host
- following this example: - ssh -N -f -L localhost:5000:localhost:5566 user@foe-03
- Access from your local browser - http://localhost:5000/enter your password
Installing anaconda
The following commands will install on a Linux machine via the terminal. After this you can conda install -c conda-forge notebook and
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
chmod 755 Miniconda3-py39_4.9.2-Linux-x86_64.sh
bash Miniconda3-py39_4.9.2-Linux-x86_64.sh
Saving notebooks for sharing
Some tips for large notebooks
- Clear output before pushing to git. 
- save as markdown - jupyter nbconvert --to markdown <file>.ipynb
- save as pdf - jupyter nbconvert --to pdf <file>.ipynb- NB notebooks containing large amounts of markdown mayrequire debugging to convert to pdf via converting latex first and running through an application that gives detailed logs like texmaker