Jupyter Notebooks: Difference between revisions

From SESLINK Wiki
Jump to navigation Jump to search
Ingo (talk | contribs)
How to use Jupyter Notebooks on Gunvor
 
Ingo (talk | contribs)
Line 3: Line 3:
# Open a terminal and log into Gunvor via SSH. Start the notebook in no-browser mode and specify a port (different from any other port on the server):
# Open a terminal and log into Gunvor via SSH. Start the notebook in no-browser mode and specify a port (different from any other port on the server):


    jupyter notebook --no-browser --port=[XXXX]
jupyter notebook --no-browser --port=[XXXX]


''Optional:'' start the notebook in tmux or screen so that you can later close the terminal while be able to run the notebook (e.g. if you are runing a lon task).
''Optional:'' start the notebook in tmux or screen so that you can later close the terminal while be able to run the notebook (e.g. if you are runing a lon task).
Line 11: Line 11:
Create an ssh tunnel to the corresponding server and binding remote port XXXX to local YYYY:
Create an ssh tunnel to the corresponding server and binding remote port XXXX to local YYYY:


    ssh -f [USER]@[SERVER] -L [YYYY]:localhost:[XXXX] -N
ssh -f [USER]@[SERVER] -L [YYYY]:localhost:[XXXX] -N


# You can now enter localhost:[YYYY] in your favorite browser to use the remote notebook!
# You can now enter localhost:[YYYY] in your favorite browser to use the remote notebook!


Attention: The port might be already occupied by another process. In the terminal you will get a warning message. Then the connection in the browser fails! Identify the process number (PID) with '''ps aux | grep -i notebook''' or '''netstat -tlnp | grep [YYYY]''' and use '''kill PID''' to remove process
Attention: The port might be already occupied by another process. In the terminal you will get a warning message. Then the connection in the browser fails! Identify the process number (PID) with ''ps aux | grep -i notebook'' or ''netstat -tlnp | grep [YYYY]'' and use ''kill PID'' to remove process

Revision as of 13:05, 23 January 2018

How to use a Jupyter Notebook on the remote server (Gunvor)

  1. Open a terminal and log into Gunvor via SSH. Start the notebook in no-browser mode and specify a port (different from any other port on the server):
jupyter notebook --no-browser --port=[XXXX]

Optional: start the notebook in tmux or screen so that you can later close the terminal while be able to run the notebook (e.g. if you are runing a lon task).

  1. Open a second terminal

Create an ssh tunnel to the corresponding server and binding remote port XXXX to local YYYY:

ssh -f [USER]@[SERVER] -L [YYYY]:localhost:[XXXX] -N
  1. You can now enter localhost:[YYYY] in your favorite browser to use the remote notebook!

Attention: The port might be already occupied by another process. In the terminal you will get a warning message. Then the connection in the browser fails! Identify the process number (PID) with ps aux | grep -i notebook or netstat -tlnp | grep [YYYY] and use kill PID to remove process