Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot quit jupyter notebook server running

Tags:

I am using Jupyter Notebook for a project. Since I ssh into a linux cluster at work I use

ssh -Y -L 8000:localhost:8888 user@host 

Then I start the notebook with jupyter notebook --no-browser & so that I can continue using the terminal. Then on my local machine I open to localhost:8000 and go about my work.

My problem is that I forgot several times to close the server by foregrounding the process and killing it with Ctrl-C. Instead I just logged out of the ssh session. Now when I run jupyter notebook list I get

Currently running servers: http://localhost:8934/ :: /export/home/jbalsells http://localhost:8870/ :: /export/home/jbalsells http://localhost:8892/ :: /export/home/jbalsells http://localhost:8891/ :: /export/home/jbalsells http://localhost:8890/ :: /export/home/jbalsells http://localhost:8889/ :: /export/home/jbalsells http://localhost:8888/ :: /export/home/jbalsells 

I obviously do not want all of these servers running on my work's machine, but I do not know how to close them!

When I run ps I get nothing:

  PID TTY          TIME CMD 12678 pts/13   00:00:00 bash 22584 pts/13   00:00:00 ps 

I have Jupyter 4.1.0 installed.

like image 649
Joalito Avatar asked Jul 21 '16 18:07

Joalito


People also ask

How do you stop a jupyter notebook server?

Normally, you can kill a Jupyter server from the same terminal window where you launched your Jupyter notebook by hit CTRL + C, then type yes, to shut down the kernels of Your jupyter notebook.

How do I stop my Jupyter lab from running?

Closing JupyterLabClick “Shut Down” to shutdown the JupyterLab server. To restart the JupyterLab server you will need to re-run the following command from a shell.

Can I leave jupyter notebook running?

3.Run the jupyter notebook in the browser of the server Then, navigate to the respective jupyter notebook file in the browser and open it. Click Cell > Run All on the toolbar. All done! Now you can leave the browser running in the remote desktop and disconnect to it anytime you want to.


1 Answers

So I found a solution.

Since jupyter notebook list tells you which ports the notebook servers are running on I looked for the PIDs using netstat -tulpn I got the information from http://www.cyberciti.biz/faq/what-process-has-open-linux-port/

Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address           Foreign Address         State        PID/Program name     tcp        0      0 0.0.0.0:8649            0.0.0.0:*               LISTEN       -                    tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN       -                    tcp        0      0 0.0.0.0:33483           0.0.0.0:*               LISTEN       -                    tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN       39125/Xvnc           

Without looking too hard I was able to find the ports I knew to look for from jupyter notebook list and the processes running them (you could use grep if it were too hard to find them). Then I killed them with kill 8337 (or whatever number was associated).

like image 102
Joalito Avatar answered Oct 01 '22 17:10

Joalito