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

could not parse JSON stream, invalid token near 'NbserverListApp' #830

Closed Hamzehn closed 2 years ago

Hamzehn commented 2 years ago

Problem description

When trying to open notebook files in some projects but not others, I often get the above error.

Steps to reproduce the problem

  1. Open a .ipynb file
  2. Try C-c C-o or ein:login
  3. Get the error: ein:process-refresh-processes: could not parse JSON stream: "invalid token near 'NbserverListApp'", "<string>", 1, 16, 16

Going through ein:run seems to work though.

System info:

("EIN system info"
 :emacs-version
 "GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2020-09-19"
 :window-system x
 :emacs-variant nil
 :build
 "--build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/27.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp --program-suffix=27 --with-modules --with-file-notification=inotify --with-mailutils --with-harfbuzz --with-json --with-x=yes --with-x-toolkit=gtk3 --with-lcms2 --with-cairo --with-xpm=yes --with-gif=yes --with-gnutls=yes --with-jpeg=yes --with-png=yes --with-tiff=yes --with-xwidgets 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs27-bifpWT/emacs27-27.1~1.git86d8d76aa3=. -fstack-protector-strong -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie'"
 :os
 (:uname
  "Linux LAPTOP------ 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
"
  :lsb-release
  "No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal
")
 :jupyter
 "jupyter core     : 4.7.1
jupyter-notebook : 6.3.0
qtconsole        : 5.0.3
ipython          : 7.22.0
ipykernel        : 5.5.3
jupyter client   : 6.1.12
jupyter lab      : 3.0.14
nbconvert        : 6.0.7
ipywidgets       : 7.6.3
nbformat         : 5.1.3
traitlets        : 5.0.5
"
 :image-types
 (svg png gif tiff jpeg xpm xbm pbm)
 :image-types-available
 (svg png gif tiff jpeg xpm xbm pbm)
 :request-backend curl
 :ein
 (:version "20211012.347"
           :source-dir "/home/hamzah/.emacs.d/elpa-27.1/ein-20211012.347/")
 :lib
 ((:name "websocket"
         :path "~/.emacs.d/elpa-27.1/websocket-20210110.17/websocket.elc"
         :featurep t
         :version-var websocket-version
         :version "1.12")
  (:name "anaphora"
         :path "~/.emacs.d/elpa-27.1/anaphora-20180618.2200/anaphora.elc"
         :featurep t
         :version-var nil
         :version nil)
  (:name "request"
         :path "~/.emacs.d/elpa-27.1/request-20210816.200/request.elc"
         :featurep t
         :version-var request-version
         :version "0.3.3")
  (:name "deferred"
         :path "~/.emacs.d/elpa-27.1/deferred-20170901.1330/deferred.elc"
         :featurep t
         :version-var deferred:version
         :version "0.5.0")
  (:name "polymode"
         :path "~/.emacs.d/elpa-27.1/polymode-20210907.807/polymode.elc"
         :featurep t
         :version-var nil
         :version nil)
  (:name "dash"
         :path "~/.emacs.d/elpa-27.1/dash-20210826.1149/dash.elc"
         :featurep t
         :version-var nil
         :version nil)
  (:name "with-editor"
         :path "~/.emacs.d/elpa-27.1/with-editor-20211028.2105/with-editor.elc"
         :featurep nil
         :version-var nil
         :version nil)))

Logs:

ein:log-all:

17:40:46:519: [warn] ein:jupyter-default-kernel: (json-end-of-file) @#<buffer *scratch*>
17:46:13:885: [warn] ein:dev-packages: Don’t call me! @#<buffer  *temp*>
dickmao commented 2 years ago

jupyter-notebook : 6.3.0 is very sus.

A standard invocation of jupyter --version should yield:

Selected Jupyter core packages...
...
notebook         : 6.4.7
...

where notebook is not prefixed by jupyter-.

You can try the instructions at #553 which tries to accommodate the old-style jupyter-notebook, but I have no confidence in something I last tried in 2019.

I would much rather pip3 uninstall jupyter-notebook and pip3 install notebook.

stephenwithav commented 11 months ago

Upgrading notebook worked for me. pip3 install --upgrade notebook