millejoh / emacs-ipython-notebook

Jupyter notebook client in Emacs
http://millejoh.github.io/emacs-ipython-notebook/
GNU General Public License v3.0
1.47k stars 122 forks source link

Error in Processing output of jupyter kernelspec list #791

Closed jasontuna closed 3 years ago

jasontuna commented 3 years ago

I opened issue #790, and it was closed as invalid. The issue was based on that jupyter kernelspec list --json will output warnings prior to the expected json, which prevent ein from functioning.

If this is not considered an issue with ein, go ahead and close it again. If it should be an issue, I can help and edit the code to process the output of "jupyter kernelspec list --json"

How attached are you to your $HOME/.jupyter/jupyter_notebook_config.py? If not at all, or if you don't even know what that is, perhaps you could:

mv $HOME/.jupyter/jupyter_notebook_config.py $HOME/.jupyter/backup.jupyter_notebook_config.py
jupyter notebook --generate-config
jupyter kernelspec list --json

If that last command, returns valid json, then you are home free.

Prior to ticket submission, I had already deleted it, and generated a new config. The error is that when running

jupyter kernelspec list --json

for many installations, the output will have a warning prior to valid json in the beginning. For me it is,

*[ListKernelSpecs]* WARNING | Config option kernel_spec_manager_class not recognized by ListKernelSpecs.

prior to outputting valid JSON.

In particular, ein assumes that "jupyter kernelspec list --json" will always output json. Sure I can delete the associated jupyter_config.json which was installed by anaconda that has { "JupyterApp": { "kernel_spec_manager_class": "nb_conda_kernels.CondaKernelSpecManager" } } which is the offending kernelspec, but it would seem warnings should not break the installation. Of course it would make more sense for "jupyter kernelspec list --json" to output json according to spec also ...

Originally posted by @jasontuna in https://github.com/millejoh/emacs-ipython-notebook/issues/790#issuecomment-800656743

dickmao commented 3 years ago

Thanks. Commit 147940d

jasontuna commented 3 years ago

Thanks. Commit 147940d

Thanks @dickmao. nice solution!