emacs-jupyter / jupyter

An interface to communicate with Jupyter kernels.
GNU General Public License v3.0
944 stars 93 forks source link

Kernel restart not working on server #530

Open LarryLegend33 opened 7 months ago

LarryLegend33 commented 7 months ago

I'm running jupyter notebooks on a server using emacs-jupyter, connecting to remote kernels using connection files. When I use C-c C-r to restart the kernel, the kernel does not restart and I get this error message. I haven't seen this come up anywhere else.

jupyter-command: Content written to stderr stream env: ‘jupyter’: No such file or directory jupyter-runtime-directory: Can’t obtain runtime directory from jupyter shell command

This is the only error I'm getting -- interrupt works, and the code in the notebook runs to completion. Thanks!

LarryLegend33 commented 6 months ago

@nnicandro just coming back here after a month to see if there's been any action on this issue; I'm still very eager to use your very cool package on Gcloud, as its working amazingly well on my home computer. if the issue of kernel restart could be addressed, i'm sure my entire group would be interested in using your system as we are all using jax on GCloud. Thanks!

nnicandro commented 5 months ago

With remote kernels using a connection file the restart method is just a shutdown followed by a launch of a new kernel process. In the launch it tries to write a new connection file to the jupyter-runtime-directory so that the launched kernel can read from that file during its initialization. The runtime directory is obtained by calling out to the shell command jupyter --runtime-dir and it seems that the remote system does not have the jupyter command available. That seems to be what is the cause of the error. There is still an issue on my end of things though. The connection file that will be written on the launch wont have the same ports as the original kernel so the newly launched kernel will have different ports than the original and the connection will most likely not work due to some port tunneling that is done when first connecting to the original kernel. This will also have to be solved, but is trivial since the original connection info can be kept around so that it can be used during the launch.

nnicandro commented 5 months ago

I'm not familiar with GCloud, but you will need to have Jupyter installed on the system for the restart to work correctly with the current implementation. Are you running the kernel inside a container without any supporting software installed in it?