You can run the notebook on the remote in no browser mode.
jupyter notebook --no-browser --port=8080
Then setup up an ssh tunnel from the local machine:
ssh -L 8080:localhost:8080 USERNAME@REMOTEHOST
Then in your local browser go to: http://localhost:8080/
Reference - https://docs.anaconda.com/anaconda/user-guide/tasks/remote-jupyter-notebook/
xxxxxxxxxx
0. [remote] move to the desired folder (root of the future jupyter server)
1. [remote] [optional] create a screen for the server,
so you can close the remote terminal and jupyter will keep running
screen -S jupyter
2. [remote] start jupyter, with no browser, on port RRRR
jupyter notebook --no-browser --port=RRRR
3. [remote] look at the output and take note of the token in
http://localhost:RRRR/?token=07994b9f01b2bb2ff3bd6a0fdef2c1294863165c7ba9c6b4
4. [remote] [optional] detatch from screen
Ctrl+A, D
5. [local] on terminal, connect local port LLLL to remote port RRRR
ssh -NfL localhost:LLLL:localhost:RRRR USER_NAME@XXX.XXX.XXX.XX
(type password for USER_NAME@XXX.XXX.XXX.XX)
6. [local]
open browser on page "localhost:LLLL"
you will see the login page for jupyter
type the token from step 3.
NOTES:
If possible RRRR = LLLL = 8888, makes everything easier
Do NOT close the local terminal until you are done
Local terminal might disconnect the ports some times: just repeat step 5.
[optional] Remember to exit the screen on remote once you are done