emacs-jupyter / jupyter

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

jupyter-rust returned "Kernel did not respond to kernel-info request" #123

Closed hwiorn closed 5 years ago

hwiorn commented 5 years ago

I want to rewrite some python code to rust code.

I tested rust, But it says below message. emacs-jupyter checks always kernel-info but rust kernel works on jupyter lab. Can i handle this?

Kernel did not respond to kernel-info request

Procedure

Install rust.

$ curl https://sh.rustup.rs -sSf | sh
$ . $HOME/.cargo/env
$ cargo install 

Install zeromq.

# On Linux
$ sudo apt install libzmq3-dev jupyter-notebook

# On MacOS
$ brew install zeromq pkg-config

Install rust kernel.

$ cargo install evcxr_jupyter
$ evcxr_jupyter --install

On Emacs.

M-x jupyter-run-repl<enter>rust<enter>
nnicandro commented 5 years ago

Can you set jupyter--debug to t and see if it shows anything interesting when you try to run a REPL again.

hwiorn commented 5 years ago

evcxr_jupyter already implement kernel_info_request protocol and kernel_info()

There seems to not respond to 'kernel-info request' in logs.

Rust kernel

jupyter-start-kernel: default-directory = /Users/gglee/
jupyter-start-kernel: Starting process with args "/Users/gglee/.cargo/bin/evcxr_jupyter --control_file /Users/gglee/Library/Jupyter/runtime/emacs-kernel-nP4deO.json"
Starting rust kernel process...done
SENDING: :kernel-info-request 9312950d-82de-46bc-8307-240fd5531924 nil
SENT: (:shell 9312950d-82de-46bc-8307-240fd5531924)
Requesting kernel info...done
helm-M-x: Kernel did not respond to kernel-info request

Python 3 kernel

jupyter-start-kernel: default-directory = /Users/gglee/
jupyter-start-kernel: Starting process with args "/Users/gglee/anaconda3/bin/python -m ipykernel_launcher -f /Users/gglee/Library/Jupyter/runtime/emacs-kernel-3zXeIQ.json"
Starting python3 kernel process...done
SENDING: :kernel-info-request 19597a47-bac9-42b4-b887-4d92fac1f4a5 nil
SENT: (:shell 19597a47-bac9-42b4-b887-4d92fac1f4a5)
MESSAGE: (:iopub :status (:execution_state busy))
MESSAGE: (:shell :kernel-info-reply (:status ok :protocol_version 5.1 :implementation ipython :implementation_version 7.5.0 :language_info (:name python :version 3.6.8 :mimetype text/x-python :codemirror_mode (:name ipython :version 3) :pygments_lexer ipython3 :nbconvert_exporter python :file_extension .py) :banner Python 3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.
nnicandro commented 5 years ago

Can you put the following

(set-process-filter
     (oref kernel process)
     (lambda (_ output) (message "KERNEL-OUTPUT: %s" output)))

just above

https://github.com/dzop/emacs-jupyter/blob/46ec412bfc08142e604c6699af0cf95e96ca8405/jupyter-kernel-manager.el#L143

so that we can see if the kernel is outputting anything useful.

There needs to be some better logging...

nnicandro commented 5 years ago

I don't use rust at all and don't see myself investigating this unless I end up using rust in the future, so hopefully someone else can investigate this issue further. I will of course help anyone who would like to tackle this issue.

hwiorn commented 5 years ago

Sorry for late reply. I was busy with work and i forgot this issue.

jupyter-start-kernel: default-directory = ~/
jupyter-start-kernel: Starting process with args "/Users/gglee/.cargo/bin/evcxr_jupyter --control_file /Users/gglee/Library/Jupyter/runtime/emacs-kernel-pfiBPR.json"
Starting rust kernel process...done
KERNEL-OUTPUT: Error: JustMessage("No such file or directory (os error 2)")

SENDING: :kernel-info-request e82378cd-5485-4391-a7f8-498848ab43aa nil
SENT: (:shell e82378cd-5485-4391-a7f8-498848ab43aa)
Requesting kernel info...done
condition-case: Kernel did not respond to kernel-info request

Ok, i found similar issue here. I added "~/.cargo/bin" to PATH in emacs environment.

It worked! Thank you :)