emacs-jupyter / jupyter

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

Kernel did not respond to kernel-info request finalizer failed when connecting remote #342

Open weidtn opened 3 years ago

weidtn commented 3 years ago

I use :session /ssh:ip#port/sessionname in the property of my file. When the IP is in the same network I have no problems. When I change the IP to connect over internet, I get no connection. SSH does work however. The full error message from Messages buffer is here:

jupyter-kernel-info: Kernel did not respond to kernel-info requestfinalizer failed: (cl-no-primary-method jupyter-kill-kernel #s(jupyter-kernel-process-manager (#<finalizer used>) jupyter--kernel-managers #s(jupyter-command-kernel (#<finalizer used>) ("python3" "/ssh:IP#Port:/usr/share/jupyter/kernels/python3" :argv ["/usr/bin/python3" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t)) #s(jupyter-session (:shell_port 34493 :iopub_port 36259 :stdin_port 41989 :control_port 44973 :hb_port 39881 :ip "127.0.0.1" :key "*******" :transport "tcp" :signature_scheme "hmac-sha256" :kernel_name "python3") "*****" "******") #<process jupyter-kernel-python3<2>>) #s(jupyter-zmq-channel :control #s(jupyter-session (:shell_port 34493 :iopub_port 36259 :stdin_port 41989 :control_port 44973 :hb_port 39881 :ip "127.0.0.1" :key "*****" :transport "tcp" :signature_scheme "hmac-sha256" :kernel_name "python3") "*****" "*******") "tcp://127.0.0.1:44973" #<user-ptr ptr=0x563a151139a0 finalizer=0x7f54c823ba10>)))

Do I need to forward these ports named in here? Do these stay the same every time? Or are they in a range I need to forward?

nnicandro commented 3 years ago

Not sure what could be going wrong here. The code responsible for connecting to different kernel sessions is somewhat convoluted. I'll have to look it over some more to figure out which parts have some bearing on this issue. From my understanding as of right now, I don't think you need to specifically do any forwarding. The jupyter-tunnel-connection function, which I think is being used for this case, will forward local ports to the remote ones specified by the remote kernel when launched.

I did clean up the kernel connection code in a new branch called next which simplifies a lot of the kernel connection stuff. I'm not sure if its ready to be tested yet, but you can give it a shot and see if it connects to the remote kernel.

weidtn commented 3 years ago

I added the ports 8888 tcp&udp and my ssh port to my firewall and now :session /ssh:ip:sessionname works (port for ssh is set in ssh config).