jupyter icon indicating copy to clipboard operation
jupyter copied to clipboard

Testers for `next` branch

Open nnicandro opened this issue 2 years ago • 34 comments

Hello all,

I have been working for a long time now on streamlining the way in which a kernel communicates with a client in order to simplify that communication from a developer perspective. I am at the stage where I would like to have some users test the changes to make sure there are no glaring bugs that I've introduced. I have changed a few parts of the code base that may have broken some people's setup, but most changes have been relegated to internal components that should not have much of an effect from a user perspective.

The biggest user facing change is the introduction of the jupyter-use-zmq variable which allows a user to specify if zmq is a library that can be used for communicating with kernels. If that variable is nil (the default depends on the value of (locate-library "zmq")) then only notebook type connections can be made to kernels, that is all kernel communication is relegated to talking to some notebook server which gives access to the WebSocket of a kernel. If that variable is non-nil then a direct connection to a kernel can be made through ZMQ sockets.

So if there is anyone who is willing to give the next branch a test spin I would greatly appreciate it. Thanks.

nnicandro avatar Jan 08 '22 18:01 nnicandro

I disabled all my current jupyter config, deleted the installed package, cloned the repo switched to next, and then installed through package-install-file (please let me know if I it's better to test it without package-install, or otherwise).

Upon starting a Python REPL, I get this error:

Debugger entered--Lisp error: (invalid-function "")
  ""()
  jupyter-bind-delayed(#s(jupyter-request :id "" :type (25051 400 200472 116000) :content nil :client nil :time nil :idle-p nil :last-message 
  #f(compiled-function () #<bytecode 0x156772be28b9>)()
  #f(compiled-function (&optional check) #<bytecode 0x156772be28d5>)()
  jupyter-bind-delayed(#s(jupyter-delayed :value #f(compiled-function (&optional check) #<bytecode 0x156772be28d5>)) #f(compiled-function (value) #<bytecode 0x156773815c11>))
  #f(compiled-function () #<bytecode 0x156772be28f5>)()
  #f(compiled-function (&optional check) #<bytecode 0x156772be2911>)()
  jupyter-bind-delayed(#s(jupyter-delayed :value #f(compiled-function (&optional check) #<bytecode 0x156772be2911>)) #f(compiled-function (value) #<bytecode 0x156773815c9d>))
  #f(compiled-function () #<bytecode 0x156772be283d>)()
  #f(compiled-function (&optional check) #<bytecode 0x156772be2859>)()
  jupyter-bind-delayed(#s(jupyter-delayed :value #f(compiled-function (&optional check) #<bytecode 0x156772be2859>)) #f(compiled-function (value) #<bytecode 0x156772be288d>))
  jupyter-kernel-info(#<jupyter-repl-client jupyter-repl-client-156773d3b230>)
  #f(compiled-function (kernel &optional client-class) #<bytecode 0x15677381f28d>)(#<jupyter-kernel python3> jupyter-repl-client)
  apply(#f(compiled-function (kernel &optional client-class) #<bytecode 0x15677381f28d>) #<jupyter-kernel python3> jupyter-repl-client)
  jupyter-client(#<jupyter-kernel python3> jupyter-repl-client)
  jupyter-run-repl("python3" nil t nil t)
  funcall-interactively(jupyter-run-repl "python3" nil t nil t)
  call-interactively(jupyter-run-repl record nil)
  command-execute(jupyter-run-repl record)

timlod avatar Jan 09 '22 15:01 timlod

That is a strange error. Could it have something to do with bad byte compilation? Can you try to delete all the elc files generated on install and call byte-recompile-directory on the package directory and try again. Also, what is your Emacs version?

nnicandro avatar Jan 14 '22 18:01 nnicandro

@timlod Could you try again with the latest changes to the next branch. I just fixed an issue that seems to be related.

nnicandro avatar Jan 14 '22 21:01 nnicandro

Switched to next today. Will test for the next couple of weeks and report back then! First thing I noticed though is that it doesn't automatically call org-redisplay-inline-images after plotting, but maybe that's related to my setup. Will investigate.

dangom avatar Jan 18 '22 15:01 dangom

Everything seems to work fine locally, but I cannot connect to remote kernels with the next branch. My emacs hangs for a while on "Requesting kernel info", and then something times out and I get an error. I tried connecting by setting the session to /ssh:user@remote:sessionname.

dangom avatar Jan 31 '22 16:01 dangom

Sorry for the late response. I'm quite busy and don't have the time to thoroughly test right now. I did, however, just change back to the next branch again (but kept the rest of my config as is). Now I get the following error (on the default kernel):

Launching python3 kernel...
Starting python3 kernel process...done
Launching python3 kernel...done
Requesting kernel info...
Loading /home/tim/.emacs.d/elpa/zmq-20210613.343/emacs-zmq.so (module)...done
Invalid function: jupyter-with-client
error in process filter: zmq--subprocess-filter: Error in ZMQ subprocess: error, ("Invalid signature: 1bfb2d77e2479bdd18e489a2c8f49e0dc0e89906b027f3fdde5dfc3eb8f4d49c")
error in process filter: Error in ZMQ subprocess: error, ("Invalid signature: 1bfb2d77e2479bdd18e489a2c8f49e0dc0e89906b027f3fdde5dfc3eb8f4d49c")

And the following on another kernel:

Launching test kernel...
Starting test kernel process...done
cl--assertion-failed: Assertion failed: (jupyter-alive-p kernel)

timlod avatar Feb 11 '22 08:02 timlod

Maybe someone wasn't properly cleaned? Did you remove all .elc and .eln files from the previous branch? I'd also try recompiling zmq

dangom avatar Feb 11 '22 16:02 dangom

@dangom I've just pushed a commit that should fix the issue with remote kernels. Please let me know if you are still facing that problem.

nnicandro avatar Feb 12 '22 00:02 nnicandro

@timlod I second the opinion that it has something to do with the byte compilation of the files. jupyter-with-client is a macro, but it looks like it's being called as a function.

nnicandro avatar Feb 12 '22 00:02 nnicandro

Got it. Will retry again this weekend. Indeed I had only pulled the branch and re-installed, could be some files were left over from my last try.

timlod avatar Feb 12 '22 09:02 timlod

The remote connections seem to work now!! However, even though I can always get them to work, they occasionally fail upon connecting (the fix is simply to retry). I'd say it works about 95% of the times without issues.

The error messages I got:

  1. Although :session specifies a remote kernel, jupyter tries to use the path to the local python instead of the remote. Perhaps some weird race condition or interaction with other packages going on?
executing Jupyter-Python code block...
Tramp: Opening connection nil for remote using ssh...done
Tramp: Opening connection jupyter-session-with-random-ports for remote using ssh...done
Tramp: Inserting ‘/ssh:remote:/home/dangom/.local/share/jupyter/runtime/kernel-b5188c43-22dd-46d5-bcbb-0afba4e37535.json’...done
Launching python3 kernel...
Tramp: Encoding local file ‘/var/folders/82/h94bb5fx2cs6chrwgdsvn4cr0000gp/T/tramp.Hamg2u.json’ using ‘base64-encode-region’...done
Tramp: Decoding remote file ‘/ssh:remote:/home/dangom/.local/share/jupyter/runtime/emacs-kernel-o6RBCO.json’ using ‘base64 -d -i >%s’...done
Tramp: Encoding local file ‘/var/folders/82/h94bb5fx2cs6chrwgdsvn4cr0000gp/T/tramp.jBtikl.json’ using ‘base64-encode-region’...done
Tramp: Decoding remote file ‘/ssh:remote:/home/dangom/.local/share/jupyter/runtime/emacs-kernel-o6RBCO.json’ using ‘base64 -d -i >%s’...done
Tramp: Opening connection jupyter-kernel-python3 for remote using ssh...done
jupyter--start-kernel-process: Kernel process exited:
env: /Users/dangom/anaconda3/bin/python: No such file or directory

Besides that, sometimes I get a random error that seems not to interfere with the connection.

executing Jupyter-Python code block...
Tramp: Opening connection nil for nutmeg using ssh...
Error running timer ‘flycheck--handle-idle-trigger’: (remote-file-error "Forbidden reentrant call of Tramp")

The kernel proceeds to connect without issues.

I also got once an error from tramp saying it couldn't find /bin/sh(unfortunately I didn't take note of that error when testing), and an error regarding company mode. These only came up once each, but didn't cause the connection to fail.

For completion, none of these ever happened on the current master. And they only happen on next with remote kernels.

If there is anything I can do to help sort these out, or any more testing that'd be relevant, let me know.

dangom avatar Feb 13 '22 15:02 dangom

This one hapens only on next, so I'm reporting it here.

Initial situation: freshly-launched instance of Emacs 27.1 on macOS, with minimal config (basically reduced to package.el-related stuff and setting up all the necessary paths) and (setq debug-on-error t).

When I do M-x jupyter-run-repl, it works as expected: a fresh REPL with selected kernel is launched.

But when I restart Emacs to get back to the initial state, and then do C-h f, followed by jupyter-run-repl, I get this error:

Debugger entered--Lisp error: (error "jupyter-kernel-name is already defined as something else than a generic function")
  signal(error ("jupyter-kernel-name is already defined as something else than a generic function"))
  error("%s is already defined as something else than a generic function" jupyter-kernel-name)
  cl-generic-ensure-function(jupyter-kernel-name)
  cl-generic-define-method(jupyter-kernel-name nil ((kernel jupyter-kernel)) nil #f(compiled-function (kernel) "Return the name of KERNEL." #<bytecode 0x1ffccd8b9b3d>))
  byte-code("\300\301\302\303\302\304%\210\300\305\302\306\302\307%\207" [cl-generic-define-method jupyter-kill-kernel nil ((_kernel jupyter-kernel)) #f(compiled-function (kernel) #<bytecode 0x1ffccd8b90f1>) jupyter-kernel-name ((kernel jupyter-kernel)) #f(compiled-function (kernel) "Return the name of KERNEL." #<bytecode 0x1ffccd8b9b3d>)] 6)
  require(jupyter-kernel-manager)
  load("jupyter-kernel-process-manager" noerror nomessage)
  help--load-prefixes((("jupyter-" "jupyter-zmq-channel" "jupyter-server" "jupyter-rest-api" "jupyter-repl" "jupyter-mime" "jupyter-messages" "jupyter-kernelspec" "jupyter-kernel-process-manager" "jupyter-kernel-manager" "jupyter-env" "jupyter-comm-layer" "jupyter-client" "jupyter-base")))
  help--symbol-completion-table("jupyter-run-repl" #f(compiled-function (f) #<bytecode 0x1ffccd84ed11>) lambda)
  test-completion("jupyter-run-repl" help--symbol-completion-table #f(compiled-function (f) #<bytecode 0x1ffccd84ed11>))
  completion--complete-and-exit(20 36 exit-minibuffer #f(compiled-function () #<bytecode 0x1ffcd188c85d>))
  completion-complete-and-exit(20 36 exit-minibuffer)
  minibuffer-complete-and-exit()
  funcall-interactively(minibuffer-complete-and-exit)
  call-interactively(minibuffer-complete-and-exit nil nil)
  command-execute(minibuffer-complete-and-exit)
  read-from-minibuffer("Describe function: " nil (keymap (10 . minibuffer-complete-and-exit) (13 . minibuffer-complete-and-exit) keymap (menu-bar keymap (minibuf "Minibuf" keymap (tab menu-item "Complete" minibuffer-complete :help "Complete as far as possible") (space menu-item "Complete Word" minibuffer-complete-word :help "Complete at most one word") (63 menu-item "List Completions" minibuffer-completion-help :help "Display all possible completions") "Minibuf")) (27 keymap (118 . switch-to-completions)) (prior . switch-to-completions) (63 . minibuffer-completion-help) (32 . minibuffer-complete-word) (9 . minibuffer-complete) keymap (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "\15" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . abort-recursive-edit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (60 . minibuffer-beginning-of-buffer) (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) nil nil nil nil)
  completing-read-default("Describe function: " help--symbol-completion-table #f(compiled-function (f) #<bytecode 0x1ffccd84ed11>) t nil nil nil nil)
  completing-read("Describe function: " help--symbol-completion-table #f(compiled-function (f) #<bytecode 0x1ffccd84ed11>) t nil nil nil)
  byte-code("\301 \302\30\303\1\203\20\0\304\305\3\"\202\21\0\306\307\310\302\311\211\6\7\205\37\0\312\6\10!&\7\211\313\232\204,\0\314\1!\262\2\1\2035\0\19\2049\0\315\316!\210\317\2!\204J\0\1\320N\204J\0\315\321\3\"\210\1)C\207" [enable-recursive-minibuffers function-called-at-point t completing-read format "Describe function (default %s): " "Describe function: " help--symbol-completion-table #f(compiled-function (f) #<bytecode 0x1ffccd84ed11>) nil symbol-name "" intern user-error "You didn't specify a function symbol" fboundp function-documentation "Symbol's function definition is void: %s"] 10)
  call-interactively(describe-function nil nil)
  command-execute(describe-function)

And for completeness' sake - continuing with M-x jupyter-run-repl gives this error:

Debugger entered--Lisp error: (wrong-type-argument cl-structure-class #s(eieio--class :name jupyter-kernel :docstring "Partial representation of a Jupyter kernel.\n\nContains the kernelspec associated with the kernel and the\n`jupyter-session' object used for communicating with the kernel\nwhen it is alive.\n\nSub-classes must call `cl-next-method-method' in their\nimplementation of `jupyter-kill-kernel'.\n\nA convenience method, `jupyter-kernel-name', is provided to\naccess the name of the kernelspec." :parents (#s(eieio--class :name jupyter-kernel-lifetime :docstring "Trait to control the lifetime of a kernel." :parents (#s(eieio--class :name jupyter-finalized-object :docstring "A list of finalizers." :parents nil :slots [#s(cl-slot-descriptor :name finalizers :initform nil :type list :props nil)] :index-table #<hash-table eq 1/65 0x1ffccd85f255> :children (jupyter-kernel-lifetime jupyter-kernel-client) :initarg-tuples nil :class-slots [] :class-allocation-values [] :default-object-cache #<jupyter-finalized-object jupyter-finalized-object-1ffccd85a044> :options (:custom-groups nil :documentation "A list of finalizers." :documentation "A base class for cleaning up resources.\nAdds the method `jupyter-add-finalizer' which maintains a list of\nfinalizer functions to be called when the object is garbage\ncollected."))) :slots [#s(cl-slot-descriptor :name finalizers :initform nil :type list :props nil)] :index-table #<hash-table eq 1/65 0x1ffccd82ce4d> :children (jupyter-kernel) :initarg-tuples nil :class-slots [] :class-allocation-values [] :default-object-cache #<jupyter-kernel-lifetime jupyter-kernel-lifetime-1ffccd82d08c> :options (:custom-groups nil :abstract t :documentation "Trait to control the lifetime of a kernel."))) :slots [#s(cl-slot-descriptor :name finalizers :initform nil :type list :props nil) #s(cl-slot-descriptor :name spec :initform unbound :type cons :props ((:documentation . "The kernelspec for this kernel.\nSPEC is in the same format as one of the elements returned by\n`jupyter-find-kernelspecs'."))) #s(cl-slot-descriptor :name session :initform unbound :type jupyter-session :props ((:documentation . "The session used for communicating with the kernel.")))] :index-table #<hash-table eq 3/65 0x1ffccd8b9021> :children nil :initarg-tuples ((:spec . spec) (:session . session)) :class-slots [] :class-allocation-values [] :default-object-cache 
  signal(wrong-type-argument (cl-structure-class #s(eieio--class :name jupyter-kernel :docstring "Partial representation of a Jupyter kernel.\n\nContains the kernelspec associated with the kernel and the\n`jupyter-session' object used for communicating with the kernel\nwhen it is alive.\n\nSub-classes must call `cl-next-method-method' in their\nimplementation of `jupyter-kill-kernel'.\n\nA convenience method, `jupyter-kernel-name', is provided to\naccess the name of the kernelspec." :parents (#s(eieio--class :name jupyter-kernel-lifetime :docstring "Trait to control the lifetime of a kernel." :parents (#s(eieio--class :name jupyter-finalized-object :docstring "A list of finalizers." :parents nil :slots [#s(cl-slot-descriptor :name finalizers :initform nil :type list :props nil)] :index-table #<hash-table eq 1/65 0x1ffccd85f255> :children (jupyter-kernel-lifetime jupyter-kernel-client) :initarg-tuples nil :class-slots [] :class-allocation-values [] :default-object-cache #<jupyter-finalized-object jupyter-finalized-object-1ffccd85a044> :options (:custom-groups nil :documentation "A list of finalizers." :documentation "A base class for cleaning up resources.\nAdds the method `jupyter-add-finalizer' which maintains a list of\nfinalizer functions to be called when the object is garbage\ncollected."))) :slots [#s(cl-slot-descriptor :name finalizers :initform nil :type list :props nil)] :index-table #<hash-table eq 1/65 0x1ffccd82ce4d> :children (jupyter-kernel) :initarg-tuples nil :class-slots [] :class-allocation-values [] :default-object-cache #<jupyter-kernel-lifetime jupyter-kernel-lifetime-1ffccd82d08c> :options (:custom-groups nil :abstract t :documentation "Trait to control the lifetime of a kernel."))) :slots [#s(cl-slot-descriptor :name finalizers :initform nil :type list :props nil) #s(cl-slot-descriptor :name spec :initform unbound :type cons :props ((:documentation . "The kernelspec for this kernel.\nSPEC is in the same format as one of the elements returned by\n`jupyter-find-kernelspecs'."))) #s(cl-slot-descriptor :name session :initform unbound :type jupyter-session :props ((:documentation . "The session used for communicating with the kernel.")))] :index-table #<hash-table eq 3/65 0x1ffccd8b9021> :children nil :initarg-tuples ((:spec . spec) (:session . session)) :class-slots [] :class-allocation-values [] :default-object-cache 
  #f(compiled-function (name &optional docstring &rest slots) "Define a struct type.\nThis macro defines a new data type called NAME that stores data\nin SLOTs.  It defines a `make-NAME' constructor, a `copy-NAME'\ncopier, a `NAME-p' predicate, and slot accessors named `NAME-SLOT'.\nYou can use the accessors to set the corresponding slots, via `setf'.\n\nNAME may instead take the form (NAME OPTIONS...), where each\nOPTION is either a single keyword or (KEYWORD VALUE) where\nKEYWORD can be one of `:conc-name', `:constructor', `:copier',\n`:predicate', `:type', `:named', `:initial-offset',\n`:print-function', `:noinline', or `:include'.  See Info\nnode `(cl)Structures' for the description of the options.\n\nEach SLOT may instead take the form (SNAME SDEFAULT SOPTIONS...), where\nSDEFAULT is the default value of that slot and SOPTIONS are keyword-value\npairs for that slot.\nSupported keywords for slots are:\n- `:read-only':  If this has a non-nil value, that slot cannot be set via `setf'.\n- `:documentation': this is a docstring describing the slot.\n- `:type': the type of the field; currently only used for documentation." #<bytecode 0x1ffcd182cd91>)((jupyter-kernel-process (:include jupyter-kernel)))
  (cl-defstruct (jupyter-kernel-process (:include jupyter-kernel)))
  eval-buffer(#<buffer  *load*> nil "/Users/xor-xor/.emacs.d/site-lisp/emacs-jupyter/jupyter-kernel-process.el" nil t)  ; Reading at buffer position 1851
  load-with-code-conversion("/Users/xor-xor/.emacs.d/site-lisp/emacs-jupyter/jupyter-kernel-process.el" "/Users/xor-xor/.emacs.d/site-lisp/emacs-jupyter/jupyter-kernel-process.el" nil t)
  require(jupyter-kernel-process)
  (cond (server (require 'jupyter-server-kernel) (apply #'jupyter-kernel args)) ((or conn-info spec) (require 'jupyter-kernel-process) (apply #'jupyter-kernel args)) (t (funcall cl--cnm)))
  (let ((server (plist-get args :server)) (conn-info (plist-get args :conn-info)) (spec (plist-get args :spec))) (cond (server (require 'jupyter-server-kernel) (apply #'jupyter-kernel args)) ((or conn-info spec) (require 'jupyter-kernel-process) (apply #'jupyter-kernel args)) (t (funcall cl--cnm))))
  (progn (let ((server (plist-get args :server)) (conn-info (plist-get args :conn-info)) (spec (plist-get args :spec))) (cond (server (require 'jupyter-server-kernel) (apply #'jupyter-kernel args)) ((or conn-info spec) (require 'jupyter-kernel-process) (apply #'jupyter-kernel args)) (t (funcall cl--cnm)))))
  (closure (cl-struct-jupyter-kernel-tags t) (cl--cnm &rest args) "\n\n(fn &rest ARGS)" (progn (let ((server (plist-get args :server)) (conn-info (plist-get args :conn-info)) (spec (plist-get args :spec))) (cond (server (require 'jupyter-server-kernel) (apply #'jupyter-kernel args)) ((or conn-info spec) (require 'jupyter-kernel-process) (apply #'jupyter-kernel args)) (t (funcall cl--cnm))))))(#f(compiled-function (&rest cnm-args) #<bytecode 0x1ffcc9a1bbd9>) :spec "my_kernel")
  apply((closure (cl-struct-jupyter-kernel-tags t) (cl--cnm &rest args) "\n\n(fn &rest ARGS)" (progn (let ((server (plist-get args :server)) (conn-info (plist-get args :conn-info)) (spec (plist-get args :spec))) (cond (server (require 'jupyter-server-kernel) (apply #'jupyter-kernel args)) ((or conn-info spec) (require 'jupyter-kernel-process) (apply #'jupyter-kernel args)) (t (funcall cl--cnm)))))) #f(compiled-function (&rest cnm-args) #<bytecode 0x1ffcc9a1bbd9>) (:spec "my_kernel"))
  #f(compiled-function (&rest args) #<bytecode 0x1ffccd89b001>)(:spec "my_kernel")
  apply(#f(compiled-function (&rest args) #<bytecode 0x1ffccd89b001>) (:spec "my_kernel"))
  #f(compiled-function (&rest cnm-args) #<bytecode 0x1ffcc9a1bbbd>)()
  funcall(#f(compiled-function (&rest cnm-args) #<bytecode 0x1ffcc9a1bbbd>))
  (if (not server) (funcall cl--cnm) (progn (or (object-of-class-p server 'jupyter-server) (cl--assertion-failed '(object-of-class-p server 'jupyter-server))) nil) (let ((spec (plist-get args :spec))) (if (stringp spec) (progn (plist-put args :spec (or (jupyter-guess-kernelspec spec (jupyter-kernelspecs server)) (error "No kernelspec matching %s @ %s" spec (eieio-oref server 'url))))))) (apply #'jupyter-server-kernel args))
  (let ((server (plist-get args :server))) (if (not server) (funcall cl--cnm) (progn (or (object-of-class-p server 'jupyter-server) (cl--assertion-failed '(object-of-class-p server 'jupyter-server))) nil) (let ((spec (plist-get args :spec))) (if (stringp spec) (progn (plist-put args :spec (or (jupyter-guess-kernelspec spec (jupyter-kernelspecs server)) (error "No kernelspec matching %s @ %s" spec (eieio-oref server 'url))))))) (apply #'jupyter-server-kernel args)))
  (progn (let ((server (plist-get args :server))) (if (not server) (funcall cl--cnm) (progn (or (object-of-class-p server 'jupyter-server) (cl--assertion-failed '(object-of-class-p server 'jupyter-server))) nil) (let ((spec (plist-get args :spec))) (if (stringp spec) (progn (plist-put args :spec (or (jupyter-guess-kernelspec spec (jupyter-kernelspecs server)) (error "No kernelspec matching %s @ %s" spec (eieio-oref server 'url))))))) (apply #'jupyter-server-kernel args))))
  (closure (cl-struct-jupyter-server-kernel-tags t) (cl--cnm &rest args) "Return a representation of a kernel on a Jupyter server.\nIf ARGS has a :server key, return a `jupyter-server-kernel'\ninitialized using ARGS.  If ARGS also has a :spec key, whose\nvalue is the name of a kernelspec, the returned kernel's spec\nslot will be the corresponding `jupyter-kernelspec'.\n\nCall the next method if ARGS does not contain :server.\n\n(fn &rest ARGS)" (progn (let ((server (plist-get args :server))) (if (not server) (funcall cl--cnm) (progn (or (object-of-class-p server 'jupyter-server) (cl--assertion-failed '(object-of-class-p server 'jupyter-server))) nil) (let ((spec (plist-get args :spec))) (if (stringp spec) (progn (plist-put args :spec (or (jupyter-guess-kernelspec spec (jupyter-kernelspecs server)) (error "No kernelspec matching %s @ %s" spec (eieio-oref server 'url))))))) (apply #'jupyter-server-kernel args)))))(#f(compiled-function (&rest cnm-args) #<bytecode 0x1ffcc9a1bbbd>) :spec "my_kernel")
  apply((closure (cl-struct-jupyter-server-kernel-tags t) (cl--cnm &rest args) "Return a representation of a kernel on a Jupyter server.\nIf ARGS has a :server key, return a `jupyter-server-kernel'\ninitialized using ARGS.  If ARGS also has a :spec key, whose\nvalue is the name of a kernelspec, the returned kernel's spec\nslot will be the corresponding `jupyter-kernelspec'.\n\nCall the next method if ARGS does not contain :server.\n\n(fn &rest ARGS)" (progn (let ((server (plist-get args :server))) (if (not server) (funcall cl--cnm) (progn (or (object-of-class-p server 'jupyter-server) (cl--assertion-failed '(object-of-class-p server 'jupyter-server))) nil) (let ((spec (plist-get args :spec))) (if (stringp spec) (progn (plist-put args :spec (or (jupyter-guess-kernelspec spec (jupyter-kernelspecs server)) (error "No kernelspec matching %s @ %s" spec (eieio-oref server 'url))))))) (apply #'jupyter-server-kernel args))))) #f(compiled-function (&rest cnm-args) #<bytecode 0x1ffcc9a1bbbd>) (:spec "my_kernel"))
  jupyter-kernel(:spec "my_kernel")
  (if jupyter-use-zmq (jupyter-kernel :spec spec) (jupyter-kernel :server (jupyter-repl-server) :spec spec))
  (jupyter-client (if jupyter-use-zmq (jupyter-kernel :spec spec) (jupyter-kernel :server (jupyter-repl-server) :spec spec)) client-class)
  (let ((spec (let ((cl-x (jupyter-guess-kernelspec kernel-name))) (progn (or (and (memq (type-of cl-x) cl-struct-jupyter-kernelspec-tags) t) (signal 'wrong-type-argument (list 'jupyter-kernelspec cl-x))) (aref cl-x 1))))) (jupyter-client (if jupyter-use-zmq (jupyter-kernel :spec spec) (jupyter-kernel :server (jupyter-repl-server) :spec spec)) client-class))
  (jupyter-bootstrap-repl (let ((spec (let ((cl-x (jupyter-guess-kernelspec kernel-name))) (progn (or (and (memq (type-of cl-x) cl-struct-jupyter-kernelspec-tags) t) (signal 'wrong-type-argument (list 'jupyter-kernelspec cl-x))) (aref cl-x 1))))) (jupyter-client (if jupyter-use-zmq (jupyter-kernel :spec spec) (jupyter-kernel :server (jupyter-repl-server) :spec spec)) client-class)) repl-name associate-buffer display)
  jupyter-run-repl("my_kernel" nil t nil t)
  funcall-interactively(jupyter-run-repl "my_kernel" nil t nil t)
  call-interactively(jupyter-run-repl record nil)
  command-execute(jupyter-run-repl record)
  execute-extended-command(nil "jupyter-run-repl" "jupyter-run-repl")
  funcall-interactively(execute-extended-command nil "jupyter-run-repl" "jupyter-run-repl")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

xor-xor avatar Mar 01 '22 19:03 xor-xor

@xor-xor Those errors appear to be related to misloading of byte compiled files I think. From the first error, there is no more jupyter-kernel-manager in the next branch. And from the second error, jupyter-kernel is no longer a class, but a struct type. Could you clear out the byte compiled files, recompile them, and try again to see if you get the same errors.

nnicandro avatar Mar 15 '22 19:03 nnicandro

Those errors appear to be related to misloading of byte compiled files I think.

@nnicandro you're right. I have wrongly assumed that having a path to next at the beginning of the load-path would effectively prevent loading old files. Sorry for reporting a false-positive!

xor-xor avatar Mar 20 '22 11:03 xor-xor

Been using the next branch for the past couple of months.

Very stable on Emacs master. Only minor issues that happen occasionally:

  1. idle request times out when connecting to remote. I've never really gotten it to work reliably over a douple hop, but it could be something with my config.
  2. had some issues with jupyter-restart-kernel not working, but those were fixed with the following patch to jupyter-repl:
@@ -1506,9 +1506,9 @@ the kernel `jupyter-current-client' is connected to."
         ;; `jupyter-start-new-kernel' that handles the status: starting message
         ;; so its easier to hook into that message.
         (message "Client's kernel may not have been shutdown")
-        (jupyter-repl--insert-banner-and-prompt client)))))
-  (when restart
-    (jupyter-hb-unpause client)))
+        (jupyter-repl--insert-banner-and-prompt client))))
+    (when restart
+      (jupyter-hb-unpause client))))
  1. sometimes minor issues copying text to/from the repl

But even with these, it's still the most convenient package to connect to jupyter kernels, and still offers a better experience than anything on VS code in terms of usability of the repl.

Thank you again for sharing. If I had the emacs-fu and jupyter knowledge, I'd be happy to contribute more to the development of the package.

dangom avatar Sep 01 '22 04:09 dangom

Sorry for the long delay in testing this again. I had done it in the meanwhile but not taken the time to report again. I just tried for the third time and unfortunately I still see the error.

Wiped my .emacs.d and installed a barebones GNU Emacs 28.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-05-07, only installing exec-path-from-shell (to get jupyter into my environment).

I again cloned emacs-jupyter, checked out next, and ran package-install-file emacs-jupyter.

Running jupyter-run-repl gets me this error:

Debugger entered--Lisp error: (invalid-function jupyter-with-client)
  jupyter-with-client(#<jupyter-repl-client jupyter-repl-client-1566fb891600> #s(jupyter-request :id "f47497bc-9084-4a79-8cfc-31a88fcca8a0" :type "kernel_info_request" :content nil :client #<jupyter-repl-client jupyter-repl-client-1566fb891600> :time (25364 23489 802631 787000) :idle-p nil :last-message nil :messages nil :message-publisher #f(compiled-function (pub-value) #<bytecode -0xd8735d60a2a576e>) :inhibited-handlers nil))
  #f(compiled-function () #<bytecode 0x569c56dfbef7597>)()
  #f(compiled-function (&optional check) #<bytecode -0x4a120b4cfc86d89>)()
  jupyter-bind-delayed(#s(jupyter-delayed :value #f(compiled-function (&optional check) #<bytecode -0x4a120b4cfc86d89>)) #f(compiled-function (value) #<bytecode -0x23931b2c68b20ea>))
  #f(compiled-function () #<bytecode -0x7a01f9ba7134344>)()
  #f(compiled-function (&optional check) #<bytecode -0x4a120b4cfc86d89>)()
  jupyter-bind-delayed(#s(jupyter-delayed :value #f(compiled-function (&optional check) #<bytecode -0x4a120b4cfc86d89>)) #f(compiled-function (value) #<bytecode -0xa1624f46e61e33e>))
  #f(compiled-function () #<bytecode 0x198376dad4113e01>)()
  #f(compiled-function (&optional check) #<bytecode -0x4a120b4cfc86d89>)()
  jupyter-bind-delayed(#s(jupyter-delayed :value #f(compiled-function (&optional check) #<bytecode -0x4a120b4cfc86d89>)) #f(compiled-function (value) #<bytecode -0xf3cdd72ff499a65>))
  #f(compiled-function () #<bytecode 0x9300811a271194f>)()
  #f(compiled-function (&optional check) #<bytecode -0x4a120b4cfc86d89>)()
  jupyter-bind-delayed(#s(jupyter-delayed :value #f(compiled-function (&optional check) #<bytecode -0x4a120b4cfc86d89>)) #f(compiled-function (value) #<bytecode 0x8b585b3d4e055d2>))
  jupyter-kernel-info(#<jupyter-repl-client jupyter-repl-client-1566fb891600>)
  #f(compiled-function (kernel &optional client-class) #<bytecode 0xb768bc81e3a6747>)(#<jupyter-kernel bm dd3ff30a…> jupyter-repl-client)
  apply(#f(compiled-function (kernel &optional client-class) #<bytecode 0xb768bc81e3a6747>) #<jupyter-kernel bm dd3ff30a…> jupyter-repl-client)
  jupyter-client(#<jupyter-kernel bm dd3ff30a…> jupyter-repl-client)
  jupyter-run-repl("bm" nil t nil t)
  funcall-interactively(jupyter-run-repl "bm" nil t nil t)
  command-execute(jupyter-run-repl record)
  execute-extended-command(nil "jupyter-run-repl" "jupyter-run-rep")
  funcall-interactively(execute-extended-command nil "jupyter-run-repl" "jupyter-run-rep")
  command-execute(execute-extended-command)

Interestingly, when I run my full config, I can get a kernel to start the first time I start-up emacs after wiping my directory. But after restarting emacs once, I again get this error (this is without toggle-debug-on-error):

Launching bm kernel...done
Requesting kernel info...
Invalid function: jupyter-with-client
Jupyter: I/O subscriber error: (wrong-type-argument stringp nil)

Launching notebook process...
Launching bm kernel...done
Requesting kernel info...
Invalid function: jupyter-with-client
Jupyter: I/O subscriber error: (wrong-type-argument stringp nil)

By the way, I also noticed that I had to (require 'tramp) to get jupyer-run-repl to run.

timlod avatar Sep 04 '22 08:09 timlod

The next branch without zmq works for me (on emacs master + pgtk) but if I try using zmq I get

error in process filter: zmq--subprocess-filter: Error in ZMQ subprocess: error, ("Invalid signature: f7bf093774bb68e5bece02ffc5aa4bce6838967432d594a9f8949d0f900a14d4")
error in process filter: Error in ZMQ subprocess: error, ("Invalid signature: f7bf093774bb68e5bece02ffc5aa4bce6838967432d594a9f8949d0f900a14d4")
Timeout before idle: #s(jupyter-org-request "d7f77cbc-5af8-4927-85aa-d6e7e2d7873e" "kernel_info_request" nil #s(jupyter-org-client jupyter--clients (#<finalizer>) "idle" 1 nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) (#[257 STUFF I DONT KNOW HOW TO COPY

(fn CH PROP)"] ... jupyter-ioloop-alive-p :alive-p] 4 "

...
(fn PUB-VALUE)"] ...)

@timlod did you manage to fix your signature?

benneti avatar Feb 14 '23 13:02 benneti

@benetti Saw this after responding to you in #431. Could you paste here the output of jupyter --version. Could you also give the output of M-x emacs-version. I'm on GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0) and I'm not getting this error.

@timlod I've made lots of changes to the next branch since your last try. Why don't you give it another shot.

nnicandro avatar Feb 15 '23 06:02 nnicandro

So first things first, I have a bit of a weird emacs build system (as I am using nixos and there might be some problems due to heavy symlinking and stuff so take all of the following with a grain of salt) however the main branch seemed to work as intended (apart from the PATH issue). Am I understanding correctly to use zmq I need to manually install zmq when I am using the next branch (else I do not have the zmq library). Without further ado: emacs-version: GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.16.0)

$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.4.0
ipykernel        : 6.15.3
ipywidgets       : not installed
jupyter_client   : 7.3.5
jupyter_core     : 4.11.2
jupyter_server   : 1.19.1
jupyterlab       : 3.5.0
nbclient         : 0.6.8
nbconvert        : 7.2.3
nbformat         : 5.7.0
notebook         : 6.4.12
qtconsole        : not installed
traitlets        : 5.4.0

Is there a way to simply figure out which libzmq is used (I assume it uses a downloaded one but I would like to double check). PS: I am on the latest commit https://github.com/nnicandro/emacs-jupyter/commit/e52a42b88041eb0ad3bf99f1de26824a667e378f .

benneti avatar Feb 15 '23 12:02 benneti

You can evaluate M-: (zmq-version) to get the libzmq version. Could you show what that is also. The version that emacs-jupyter is tested against is 4.3.1.

Also, what kernel does this error happen with. Are you using the builtin ipython kernel? I'm using ipykernel 6.13.0, you appear to be using a newer version so that might be one possible source of the issue.

nnicandro avatar Feb 16 '23 16:02 nnicandro

Actually on the latest commits it seems nothing (which means neither using or not using zmq) is working anymore.

Debugger entered--Lisp error: (void-variable original)
  apply(debug (error (void-variable original)))
  (let ((backtrace (doom-backtrace))) (setq num-nonmacro-input-events (1+ num-nonmacro-input-events)) (apply #'debug args))
  doom-debugger(error (void-variable original))
  jupyter--encode((:parent_header #<hash-table eql 0/1 0x306ebbf> :header (:msg_id "91cf4328-5a14-49ea-8ced-89326a02f9e8" :msg_type "kernel_info_request" :version "5.3" :username "benneti" :session "a2bdd8f4-c0e7-4361-a0dd-7a3384ff8ffb" :date "2023-02-16T20:59:38.458763+0100") :content #<hash-table eql 0/1 0x306ebbf> :metadata #<hash-table eql 0/1 0x306ebbf> :buffers [] :channel "shell"))
  jupyter-encode-raw-message(#s(jupyter-session :conn-info nil :id "a2bdd8f4-c0e7-4361-a0dd-7a3384ff8ffb" :key nil) "kernel_info_request" :channel "shell" :msg-id "91cf4328-5a14-49ea-8ced-89326a02f9e8" :content nil)
  #f(compiled-function (event) #<bytecode 0xb4b617b009c52cd>)((send "shell" "kernel_info_request" nil "91cf4328-5a14-49ea-8ced-89326a02f9e8"))
  jupyter-pseudo-bind-content(#f(compiled-function (event) #<bytecode 0xb4b617b009c52cd>) (send "shell" "kernel_info_request" nil "91cf4328-5a14-49ea-8ced-89326a02f9e8") (subscribers #f(compiled-function (pub-value) #<bytecode -0x15cebf3bf87a918b>)))
  #f(compiled-function (pub-value) #<bytecode 0x10aa695a8040ef69>)((content (send "shell" "kernel_info_request" nil "91cf4328-5a14-49ea-8ced-89326a02f9e8")))
  #f(compiled-function (io) #<bytecode -0x18016a1c5badc94d>)(#f(compiled-function (pub-value) #<bytecode 0x10aa695a8040ef69>))
  #f(compiled-function (state) #<bytecode -0x1eb69944d47996e0>)(#f(compiled-function (pub-value) #<bytecode 0x10aa695a8040ef69>))
  #f(compiled-function (state) #<bytecode 0x25db7719a66258c>)(#f(compiled-function (pub-value) #<bytecode 0x10aa695a8040ef69>))
  jupyter-run-with-state(#f(compiled-function (pub-value) #<bytecode 0x10aa695a8040ef69>) #f(compiled-function (state) #<bytecode 0x25db7719a66258c>))
  #f(compiled-function (req) #<bytecode -0xcf961bdec517bdc>)(#s(jupyter-request :id "91cf4328-5a14-49ea-8ced-89326a02f9e8" :type "kernel_info_request" :content nil :client #<jupyter-repl-client jupyter-repl-client-1e23a14> :time (25582 35626 458749 342000) :idle-p nil :last-message nil :messages nil :message-publisher #f(compiled-function (pub-value) #<bytecode -0x15cebf3bf87a918b>) :inhibited-handlers nil))
  #f(compiled-function (state) #<bytecode 0x66482d4644bb5a1>)(#<jupyter-repl-client jupyter-repl-client-1e23a14>)
  #f(compiled-function (state) #<bytecode 0x4578c2f1522d1f5>)(#<jupyter-repl-client jupyter-repl-client-1e23a14>)
  #f(compiled-function (state) #<bytecode -0x1d90e9b38506d041>)(#<jupyter-repl-client jupyter-repl-client-1e23a14>)
  #f(compiled-function (state) #<bytecode 0xe337d91dbb4d877>)(#<jupyter-repl-client jupyter-repl-client-1e23a14>)
  #f(compiled-function (state) #<bytecode 0xe337d91dbb08677>)(#<jupyter-repl-client jupyter-repl-client-1e23a14>)
  #f(compiled-function (state) #<bytecode -0x16a67099f1a6589e>)(#<jupyter-repl-client jupyter-repl-client-1e23a14>)
  jupyter-run-with-state(#<jupyter-repl-client jupyter-repl-client-1e23a14> #f(compiled-function (state) #<bytecode -0x16a67099f1a6589e>))
  jupyter-kernel-info(#<jupyter-repl-client jupyter-repl-client-1e23a14>)
  #f(compiled-function (kernel &optional client-class) #<bytecode 0x3265f5e936e87d1>)(#<jupyter-kernel julia-1.8 082f26d0…> jupyter-repl-client)
  apply(#f(compiled-function (kernel &optional client-class) #<bytecode 0x3265f5e936e87d1>) #<jupyter-kernel julia-1.8 082f26d0…> jupyter-repl-client)
  jupyter-client(#<jupyter-kernel julia-1.8 082f26d0…> jupyter-repl-client)
  jupyter-run-repl("julia-1.8" nil t nil t)
  #<subr funcall-interactively>(jupyter-run-repl "julia-1.8" nil t nil t)
  apply(#<subr funcall-interactively> (jupyter-run-repl "julia-1.8" nil t nil t))
  funcall-interactively(jupyter-run-repl "julia-1.8" nil t nil t)
  #<subr call-interactively>(jupyter-run-repl record nil)
  apply(#<subr call-interactively> (jupyter-run-repl record nil))
  explain-pause--wrap-call-interactively(#<subr call-interactively> jupyter-run-repl record nil)
  apply(explain-pause--wrap-call-interactively #<subr call-interactively> (jupyter-run-repl record nil))
  call-interactively(jupyter-run-repl record nil)
  command-execute(jupyter-run-repl record)
  counsel-M-x-action("jupyter-run-repl")
  ivy-call()
  ivy-read("M-x " ("jupyter-run-repl" "doom/reload-env" "cd" "5x5" "amx" "arp" "dbx" "bibtex-reformat" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "wos" "xdb" "calc" "deer" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "lsp!" "mail" "mpuz" "mu4e" "ping" "pong" "talk" "term" "undo" "yank" "zone" "=mu4e" "align" "chmod" "debug" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  #<subr funcall-interactively>(counsel-M-x)
  apply(#<subr funcall-interactively> counsel-M-x)
  funcall-interactively(counsel-M-x)
  #<subr call-interactively>(counsel-M-x nil nil)
  apply(#<subr call-interactively> (counsel-M-x nil nil))
  explain-pause--wrap-call-interactively(#<subr call-interactively> counsel-M-x nil nil)
  apply(explain-pause--wrap-call-interactively #<subr call-interactively> (counsel-M-x nil nil))
  call-interactively(counsel-M-x nil nil)
  command-execute(counsel-M-x)

reverting back to the commit from yesterday I can tell you I am using zmq 4.3.4 it happens with all my kernels:

$ jupyter kernelspec list                                                                                                              
Available kernels:
  julia-1.8    /nix/store/08zz13a6q9sjyg8rnylnyimfrns9r5f3-julia-env/share/jupyter/kernels/julia-1.8
  python3      /nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/share/jupyter/kernels/python3
  sagemath     /nix/store/0d8l6md8jx8lcvjgfm9rzizsmv4pqj17-sagemath-kernel/share/jupyter/kernels/sagemath

If it is related to the zmq version should it not also happen with the main branch (which I thought was also using zmq)?

benneti avatar Feb 16 '23 20:02 benneti

I fixed the issue with the original variable not being defined.

Your right, it looks like this is not a ZMQ issue if your not getting the error on the main branch.

Could you try again with the latest changes and report back here the contents of the invalid signature error message. I've updated that message to include the contents of what is being signed b792d15ba33c004926989bd07226e1840c10d452.

nnicandro avatar Feb 16 '23 22:02 nnicandro

Thank you for the effort! Here are the relevant lines

error in process filter: zmq--subprocess-filter: Error in ZMQ subprocess: error, ("Invalid signature (f62e93dac09e36c404e8a1a8dbcfadd530a52a8b9eb5f58ea31cbd66c0ee3496) for parts (\"{\\\"msg_id\\\": \\\"fb3959c4-6019c39dc787cf710530a8a6_87175_2\\\", \\\"msg_type\\\": \\\"stream\\\", \\\"username\\\": \\\"benneti\\\", \\\"session\\\": \\\"fb3959c4-6019c39dc787cf710530a8a6\\\", \\\"date\\\": \\\"2023-02-17T07:38:25.849460Z\\\", \\\"version\\\": \\\"5.3\\\"}\" \"{}\" \"{}\" \"{\\\"name\\\": \\\"stderr\\\", \\\"text\\\": \\\"--- Logging error ---\\\\nTraceback (most recent call last):\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 365, in dispatch_shell\\\\n    msg = self.session.deserialize(msg, content=True, copy=False)\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/jupyter_client/session.py\\\\\\\", line 1056, in deserialize\\\\n    raise ValueError(\\\\\\\"Invalid Signature: %r\\\\\\\" % signature)\\\\nValueError: Invalid Signature: b'c432c2ebb2bf4823e05f0bd554a27f45e28ea489cbee37a7116340d4bbdb4bb4'\\\\n\\\\nDuring handling of the above exception, another exception occurred:\\\\n\\\\nTraceback (most recent call last):\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/logging/__init__.py\\\\\\\", line 1104, in emit\\\\n    self.flush()\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/logging/__init__.py\\\\\\\", line 1084, in flush\\\\n    self.stream.flush()\\\\nOSError: [Errno 5] Input/output error\\\\nCall stack:\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/runpy.py\\\\\\\", line 196, in _run_module_as_main\\\\n    return _run_code(code, main_globals, None,\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/runpy.py\\\\\\\", line 86, in _run_code\\\\n    exec(code, run_globals)\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel_launcher.py\\\\\\\", line 17, in <module>\\\\n    app.launch_new_instance()\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/traitlets/config/application.py\\\\\\\", line 978, in launch_instance\\\\n    app.start()\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelapp.py\\\\\\\", line 712, in start\\\\n    self.io_loop.start()\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/tornado/platform/asyncio.py\\\\\\\", line 215, in start\\\\n    self.asyncio_loop.run_forever()\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/base_events.py\\\\\\\", line 603, in run_forever\\\\n    self._run_once()\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/base_events.py\\\\\\\", line 1906, in _run_once\\\\n    handle._run()\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/events.py\\\\\\\", line 80, in _run\\\\n    self._context.run(self._callback, *self._args)\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 510, in dispatch_queue\\\\n    await self.process_one()\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 499, in process_one\\\\n    await dispatch(*args)\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 367, in dispatch_shell\\\\n    self.log.error(\\\\\\\"Invalid Message\\\\\\\", exc_info=True)\\\\nMessage: 'Invalid Message'\\\\nArguments: ()\\\\n\\\"}\")")
error in process filter: Error in ZMQ subprocess: error, ("Invalid signature (f62e93dac09e36c404e8a1a8dbcfadd530a52a8b9eb5f58ea31cbd66c0ee3496) for parts (\"{\\\"msg_id\\\": \\\"fb3959c4-6019c39dc787cf710530a8a6_87175_2\\\", \\\"msg_type\\\": \\\"stream\\\", \\\"username\\\": \\\"benneti\\\", \\\"session\\\": \\\"fb3959c4-6019c39dc787cf710530a8a6\\\", \\\"date\\\": \\\"2023-02-17T07:38:25.849460Z\\\", \\\"version\\\": \\\"5.3\\\"}\" \"{}\" \"{}\" \"{\\\"name\\\": \\\"stderr\\\", \\\"text\\\": \\\"--- Logging error ---\\\\nTraceback (most recent call last):\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 365, in dispatch_shell\\\\n    msg = self.session.deserialize(msg, content=True, copy=False)\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/jupyter_client/session.py\\\\\\\", line 1056, in deserialize\\\\n    raise ValueError(\\\\\\\"Invalid Signature: %r\\\\\\\" % signature)\\\\nValueError: Invalid Signature: b'c432c2ebb2bf4823e05f0bd554a27f45e28ea489cbee37a7116340d4bbdb4bb4'\\\\n\\\\nDuring handling of the above exception, another exception occurred:\\\\n\\\\nTraceback (most recent call last):\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/logging/__init__.py\\\\\\\", line 1104, in emit\\\\n    self.flush()\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/logging/__init__.py\\\\\\\", line 1084, in flush\\\\n    self.stream.flush()\\\\nOSError: [Errno 5] Input/output error\\\\nCall stack:\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/runpy.py\\\\\\\", line 196, in _run_module_as_main\\\\n    return _run_code(code, main_globals, None,\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/runpy.py\\\\\\\", line 86, in _run_code\\\\n    exec(code, run_globals)\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel_launcher.py\\\\\\\", line 17, in <module>\\\\n    app.launch_new_instance()\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/traitlets/config/application.py\\\\\\\", line 978, in launch_instance\\\\n    app.start()\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelapp.py\\\\\\\", line 712, in start\\\\n    self.io_loop.start()\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/tornado/platform/asyncio.py\\\\\\\", line 215, in start\\\\n    self.asyncio_loop.run_forever()\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/base_events.py\\\\\\\", line 603, in run_forever\\\\n    self._run_once()\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/base_events.py\\\\\\\", line 1906, in _run_once\\\\n    handle._run()\\\\n  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/events.py\\\\\\\", line 80, in _run\\\\n    self._context.run(self._callback, *self._args)\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 510, in dispatch_queue\\\\n    await self.process_one()\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 499, in process_one\\\\n    await dispatch(*args)\\\\n  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 367, in dispatch_shell\\\\n    self.log.error(\\\\\\\"Invalid Message\\\\\\\", exc_info=True)\\\\nMessage: 'Invalid Message'\\\\nArguments: ()\\\\n\\\"}\")")
Timeout before idle: #s(jupyter-request "290487bc-5644-4319-a59c-25481f4e4840" "kernel_info_request" nil #s(jupyter-repl-client jupyter--clients (#<finalizer>) "idle" 1 nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) (#[257 "STUFF WITH ESCAPED SYMBOLS COPY DOES NOT LIKE AND LOTS OF THEM" [... plist-get] 6 "

the first line python traceback in a better format:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/logging/__init__.py\\\\\\\", line 1104, in emit
    self.flush()
  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/logging/__init__.py\\\\\\\", line 1084, in flush
    self.stream.flush()
OSError: [Errno 5] Input/output error
Call stack:
  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/runpy.py\\\\\\\", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/runpy.py\\\\\\\", line 86, in _run_code
    exec(code, run_globals)
  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel_launcher.py\\\\\\\", line 17, in <module>
    app.launch_new_instance()
  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/traitlets/config/application.py\\\\\\\", line 978, in launch_instance
    app.start()
  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelapp.py\\\\\\\", line 712, in start
    self.io_loop.start()
  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/tornado/platform/asyncio.py\\\\\\\", line 215, in start
    self.asyncio_loop.run_forever()
  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/base_events.py\\\\\\\", line 603, in run_forever
    self._run_once()
  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/base_events.py\\\\\\\", line 1906, in _run_once
    handle._run()
  File \\\\\\\"/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/asyncio/events.py\\\\\\\", line 80, in _run
    self._context.run(self._callback, *self._args)
  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 510, in dispatch_queue
    await self.process_one()
  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 499, in process_one
    await dispatch(*args)
  File \\\\\\\"/nix/store/339zl9sxb2lvnrnza1jnqlp48nyb82vv-python3-3.10.9-env/lib/python3.10/site-packages/ipykernel/kernelbase.py\\\\\\\", line 367, in dispatch_shell
    self.log.error(\\\\\\\"Invalid Message\\\\\\\", exc_info=True)
Message: 'Invalid Message'
Arguments: ()
\\\"}\")")

benneti avatar Feb 17 '23 07:02 benneti

(I am not sure you want this here, I will open a separate issue, if needed)

I switched from legacy emacs to emacs-doom and in the process couldn't get my old jupyter setup running due to some zmq related errors. I tested the next branch to circumvent that and it worked out nicely! I only noticed one bug which is a little annoying, but not super bad: the :display setting does not do anything, results are always as in :display plain

Example:

jupyter version (same for both)
(conda) [user@computer ~]$ jupyter --version
Selected Jupyter core packages...
IPython          : 7.29.0
ipykernel        : 6.4.1
ipywidgets       : not installed
jupyter_client   : 7.1.0
jupyter_core     : 4.9.1
jupyter_server   : 1.4.1
jupyterlab       : 3.2.1
nbclient         : 0.5.3
nbconvert        : 6.1.0
nbformat         : 5.1.3
notebook         : 6.4.6
qtconsole        : not installed
traitlets        : 5.1.1
 
Old setup
#+begin_src jupyter-python :session test :display html 
import pandas as pd

df = pd.DataFrame([[0, 1, 2, 3], [4, 5, 6, 7]])

display(df)
#+end_src
#+RESULTS:
#+begin_export html
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>0</td>
      <td>1</td>
      <td>2</td>
      <td>3</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4</td>
      <td>5</td>
      <td>6</td>
      <td>7</td>
    </tr>
  </tbody>
</table>
</div>
#+end_export

Usually, I convert the output to an org-table with pandoc:

#+begin_src jupyter-python :session test :display html :pandoc t
import pandas as pd

df = pd.DataFrame([[0, 1, 2, 3], [4, 5, 6, 7]])

display(df)
#+end_src
#+RESULTS:
:RESULTS:
|   | 0 | 1 | 2 | 3 |
|---+---+---+---+---|
| 0 | 0 | 1 | 2 | 3 |
| 1 | 4 | 5 | 6 | 7 |
:END:
#+begin_src emacs-lisp
  (emacs-version)
#+end_src

#+RESULTS:
: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6)
:  of 2023-01-03
New setup
#+begin_src jupyter-python :session test :display html 
import pandas as pd

df = pd.DataFrame([[0, 1, 2, 3], [4, 5, 6, 7]])

display(df)
#+end_src
#+RESULTS:
:    0  1  2  3
: 0  0  1  2  3
: 1  4  5  6  7

Of course, pandoc has nothing to work with here, so the desired org-mode table output does not show up.

#+begin_src emacs-lisp
  (emacs-version)
#+end_src

#+RESULTS:
: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6)
:  of 2023-01-03

doom/info yields:

generated  Jun 07, 2023 14:14:39
system     "Manjaro Linux" Linux 5.15.114-1-MANJARO x86_64 x
emacs      28.2 ~/Programme/doom-emacs/
doom       3.0.0-pre PROFILE=_@0 HEAD -> master 07fca7861 2023-05-30 19:39:04 -0400
           ~/.doom.d/
shell      /bin/bash
features   ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
           JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
           PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE
           XIM XPM GTK3 ZLIB
traits     gui server-running chemacs-2.0
modules    :config use-package :completion company vertico :ui deft doom
           doom-dashboard (emoji +unicode) hl-todo minimap modeline ophints (popup
           +defaults) (treemacs +lsp) (vc-gutter +pretty) vi-tilde-fringe workspaces
           zen :editor (evil +everywhere) fold snippets :emacs dired electric (undo
           +tree) vc :checkers syntax :tools (eval +overlay) lookup lsp magit pdf rgb
           tree-sitter :lang data emacs-lisp (ess +tree-sitter) latex (markdown +grip)
           (org +dragndrop +jupyter +hugo +present) (python +conda +cython
           +tree-sitter +lsp +pyright) (sh +tree-sitter) (web +tree-sitter) (yaml
           +tree-sitter) :config literate (default +bindings +smartparens)
packages   (zetteldeft) (rainbow-identifiers) (zotxt) (ob-tmux) (jupyter :recipe
           (:branch next))
unpin      jupyter

aseltmann avatar Jun 07 '23 12:06 aseltmann

@benneti are you still having this issue? I am also in NixOS unstable. For a while it was gone, but now it is back again, see #464

Panadestein avatar Jun 15 '23 13:06 Panadestein

I did not get it to work with zmq (but I think this is some glib issue due to mixing different nixos channels on my end, but fixing this is not worth it right now). I also get some error without zmq but it goes away if I immediately run the same source block again.

benneti avatar Jun 15 '23 13:06 benneti

@aseltmann Could you open up a new issue with regards to :display not working properly as I've already merged in the next branch. Looking at the code, there is no obvious reason why it shouldn't work anymore. On my machine and running the next branch I get the correct result, i.e. :display plain gives plain text and :display html gives html. Can you show what the value of the variable jupyter-org-mime-types is? It should be something like

(:text/org :image/svg+xml :image/jpeg :image/png :text/html :text/markdown :text/latex :text/plain)

nnicandro avatar Jun 17 '23 01:06 nnicandro

@benneti how did you manage to use emacs-jupyter without zmq? I am using straight.el, I only have a use-package definition for emacs-jupyter, but it seems to pull emacs-zmq also.

Panadestein avatar Jun 17 '23 12:06 Panadestein

I have emacs-zmq installed but you can (setq jupyter-use-zmq nil).

On 17 June 2023 14:02:45 CEST, "Ramón L. Panadés-Barrueta" @.***> wrote:

@benneti how did you manage to use emacs-jupyter without zmq? I am using straight.el, I only have a use-package definition for emacs-jupyter, but it seems to pull emacs-zmq also.

-- Reply to this email directly or view it on GitHub: https://github.com/emacs-jupyter/jupyter/issues/375#issuecomment-1595723950 You are receiving this because you were mentioned.

Message ID: @.***>

benneti avatar Jun 17 '23 12:06 benneti

@nnicandro I will open a new issue regarding :display

Because you said that you merged the next branch, I wanted to check if my jupyter workflow works now with the normal branch. Sadly it does not - maybe you've got an idea?

Here is my config:

emacs-version, doom/info, jupyter --version, relevant literate config
GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6) of 2023-01-03
generated  Jun 28, 2023 15:22:05
system     "Manjaro Linux" Linux 5.15.114-2-MANJARO x86_64 x
emacs      28.2 ~/Programme/doom-emacs/
doom       3.0.0-pre PROFILE=_@0 HEAD -> master 07fca7861 2023-05-30 19:39:04 -0400
           ~/.doom.d/
shell      /bin/bash
features   ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
           JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
           INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11
           XDBE XIM XPM GTK3 ZLIB
traits     gui server-running chemacs-2.0
modules    :config use-package :completion company vertico :ui deft doom
           doom-dashboard (emoji +unicode) hl-todo minimap modeline ophints (popup
           +defaults) (treemacs +lsp) (vc-gutter +pretty) vi-tilde-fringe workspaces
           zen :editor (evil +everywhere) fold snippets :emacs dired electric (undo
           +tree) vc :checkers syntax :tools (eval +overlay) lookup lsp magit pdf rgb
           tree-sitter :lang data emacs-lisp (ess +tree-sitter) latex (markdown +grip)
           (org +dragndrop +jupyter +hugo +present) (python +conda +cython
           +tree-sitter +lsp +pyright) (sh +tree-sitter) (web +tree-sitter) (yaml
           +tree-sitter) :config literate (default +bindings +smartparens)
packages   (zetteldeft) (rainbow-identifiers) (zotxt) (ob-tmux)
(conda) [user@computer ~]$ jupyter --version
Selected Jupyter core packages...
IPython          : 7.29.0
ipykernel        : 6.4.1
ipywidgets       : not installed
jupyter_client   : 7.1.0
jupyter_core     : 4.9.1
jupyter_server   : 1.4.1
jupyterlab       : 3.2.1
nbclient         : 0.5.3
nbconvert        : 6.1.0
nbformat         : 5.1.3
notebook         : 6.4.6
qtconsole        : not installed
traitlets        : 5.1.1

relevant literate config:

Unfortunately, there is a bug with displaying ansi colors correctly:
https://github.com/nnicandro/emacs-jupyter/issues/366

The following hook should take care of that:

#+BEGIN_SRC emacs-lisp
  (defun display-ansi-colors ()
  (ansi-color-apply-on-region (point-min) (point-max)))

  (add-hook 'org-babel-after-execute-hook #'display-ansi-colors)
#+END_SRC

#+begin_src emacs-lisp
  (setq jupyter-use-zmq nil)
#+end_src

In org document:

* some org heading
   :PROPERTIES:
   :header-args:jupyter-python: :session /jpy:localhost#8888:a37e524a-8134-4d8f-b24a-367acaf1bdd3 :pandoc t
   :END:

      #+begin_src sh :session local
        conda activate tf
        jupyter lab --no-browser --port=8888
      #+end_src

     #+BEGIN_SRC jupyter-python
       %cd ~
     #+END_SRC

After executing the jupyter-python block once:

Error in *Messages* part 1
Loading /home/lex/Programme/doom-emacs/.local/straight/build-28.2/zmq/emacs-zmq (module)...done
Executing Jupyter-Python unknown at position 511229...
org-babel-jupyter-session-key: Need a valid session and a kernel to form a key

After executing the jupyter-python block a second time:

Error in *Messages* part 2
Executing Jupyter-Python unknown at position 511229...
error in process filter: zmq--subprocess-filter: Error in ZMQ subprocess: void-function, (nil)
error in process filter: Error in ZMQ subprocess: void-function, (nil)
jupyter-server--connect-channels: Timeout when connecting websocket to kernel id 0450dc51-c915-4be3-8b69-6c2ceb7df3e3finalizer failed: (cl-no-primary-method jupyter-kill-kernel #s(jupyter-server-kernel-manager (#<finalizer used>) jupyter--kernel-managers #s(jupyter-server-kernel (#<finalizer used>) ("python3" nil :argv ["/home/lex/Programme/miniconda3/envs/tf/bin/python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t)) eieio--unbound #s(jupyter-server "http://localhost:8888" "ws://localhost:8888" t (#s(hash-table size 1 test eql weakness value rehash-size 1.5 rehash-threshold 0.8125 data (t #s(jupyter-server-kernel-comm nil #2)))) #s(jupyter-server-ioloop (#<finalizer>) #<process zmq> nil ((disconnect-channels (kernel-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (jupyter-server-ioloop--recv-messages) (when ws (jupyter-server-ioloop--disconnect ws)) (list 'disconnect-channels kernel-id)))) (connect-channels (kernel-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (unless ws (url-cookie-parse-file) (jupyter-server-ioloop--connect kernel-id))) (jupyter-server-ioloop--recv-messages) (list 'connect-channels kernel-id))) (send (kernel-id channel msg-type msg msg-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (unless ws (error "Kernel with ID (%s) not connected" kernel-id)) (websocket-send-text ws (jupyter-encode-raw-message (plist-get (websocket-client-data ws) :session) msg-type :channel (substring (symbol-name channel) 1) :msg-id msg-id :content msg)) (jupyter-server-ioloop--recv-messages) (list 'sent kernel-id channel msg-id))))) ((jupyter-api-with-subprocess-setup (require 'jupyter-server-ioloop) (push 'jupyter-server-ioloop--recv-messages jupyter-ioloop-pre-hook) (setq jupyter-server-timeout (/ jupyter-ioloop-timeout 4) jupyter-ioloop-timeout (* 3 (/ jupyter-ioloop-timeout 4))) (setq jupyter-server-rest-client (jupyter-rest-client :url "http://localhost:8888" :ws-url "ws://localhost:8888" :auth 'nil)))) nil "http://localhost:8888" "ws://localhost:8888" nil) (:default "python3" :kernelspecs (("python3" nil :argv ["/home/lex/Programme/miniconda3/envs/tf/bin/python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t))))) "0450dc51-c915-4be3-8b69-6c2ceb7df3e3") #s(jupyter-server-kernel-comm nil #s(jupyter-server-kernel (#<finalizer used>) ("python3" nil :argv ["/home/lex/Programme/miniconda3/envs/tf/bin/python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t)) eieio--unbound #s(jupyter-server "http://localhost:8888" "ws://localhost:8888" t (#s(hash-table size 1 test eql weakness value rehash-size 1.5 rehash-threshold 0.8125 data (t #2))) #s(jupyter-server-ioloop (#<finalizer>) #<process zmq> nil ((disconnect-channels (kernel-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (jupyter-server-ioloop--recv-messages) (when ws (jupyter-server-ioloop--disconnect ws)) (list 'disconnect-channels kernel-id)))) (connect-channels (kernel-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (unless ws (url-cookie-parse-file) (jupyter-server-ioloop--connect kernel-id))) (jupyter-server-ioloop--recv-messages) (list 'connect-channels kernel-id))) (send (kernel-id channel msg-type msg msg-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (unless ws (error "Kernel with ID (%s) not connected" kernel-id)) (websocket-send-text ws (jupyter-encode-raw-message (plist-get (websocket-client-data ws) :session) msg-type :channel (substring (symbol-name channel) 1) :msg-id msg-id :content msg)) (jupyter-server-ioloop--recv-messages) (list 'sent kernel-id channel msg-id))))) ((jupyter-api-with-subprocess-setup (require 'jupyter-server-ioloop) (push 'jupyter-server-ioloop--recv-messages jupyter-ioloop-pre-hook) (setq jupyter-server-timeout (/ jupyter-ioloop-timeout 4) jupyter-ioloop-timeout (* 3 (/ jupyter-ioloop-timeout 4))) (setq jupyter-server-rest-client (jupyter-rest-client :url "http://localhost:8888" :ws-url "ws://localhost:8888" :auth 'nil)))) nil "http://localhost:8888" "ws://localhost:8888" nil) (:default "python3" :kernelspecs (("python3" nil :argv ["/home/lex/Programme/miniconda3/envs/tf/bin/python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t))))) "0450dc51-c915-4be3-8b69-6c2ceb7df3e3"))))

Starting from third execution:

Error in *Messages* part 3
Executing Jupyter-Python unknown at position 511229...
error in process filter: zmq--subprocess-filter: Error in ZMQ subprocess: void-function, (nil)
error in process filter: Error in ZMQ subprocess: void-function, (nil)
error in process filter: zmq--subprocess-filter: Error in ZMQ subprocess: void-function, (nil)
error in process filter: Error in ZMQ subprocess: void-function, (nil)
Assertion failed: (process-live-p process)finalizer failed: (cl-no-primary-method jupyter-kill-kernel #s(jupyter-server-kernel-manager (#<finalizer used>) jupyter--kernel-managers #s(jupyter-server-kernel (#<finalizer used>) ("python3" nil :argv ["/home/lex/Programme/miniconda3/envs/tf/bin/python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t)) eieio--unbound #s(jupyter-server "http://localhost:8888" "ws://localhost:8888" t (#s(hash-table size 1 test eql weakness value rehash-size 1.5 rehash-threshold 0.8125 data (t #s(jupyter-server-kernel-comm nil #2)))) #s(jupyter-server-ioloop (#<finalizer>) #<process zmq<1>> nil ((disconnect-channels (kernel-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (jupyter-server-ioloop--recv-messages) (when ws (jupyter-server-ioloop--disconnect ws)) (list 'disconnect-channels kernel-id)))) (connect-channels (kernel-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (unless ws (url-cookie-parse-file) (jupyter-server-ioloop--connect kernel-id))) (jupyter-server-ioloop--recv-messages) (list 'connect-channels kernel-id))) (send (kernel-id channel msg-type msg msg-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (unless ws (error "Kernel with ID (%s) not connected" kernel-id)) (websocket-send-text ws (jupyter-encode-raw-message (plist-get (websocket-client-data ws) :session) msg-type :channel (substring (symbol-name channel) 1) :msg-id msg-id :content msg)) (jupyter-server-ioloop--recv-messages) (list 'sent kernel-id channel msg-id))))) ((jupyter-api-with-subprocess-setup (require 'jupyter-server-ioloop) (push 'jupyter-server-ioloop--recv-messages jupyter-ioloop-pre-hook) (setq jupyter-server-timeout (/ jupyter-ioloop-timeout 4) jupyter-ioloop-timeout (* 3 (/ jupyter-ioloop-timeout 4))) (setq jupyter-server-rest-client (jupyter-rest-client :url "http://localhost:8888" :ws-url "ws://localhost:8888" :auth 'nil)))) nil "http://localhost:8888" "ws://localhost:8888" nil) (:default "python3" :kernelspecs (("python3" nil :argv ["/home/lex/Programme/miniconda3/envs/tf/bin/python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t))))) "71b07ae7-822a-4f8d-8876-0328bf319fce") #s(jupyter-server-kernel-comm nil #s(jupyter-server-kernel (#<finalizer used>) ("python3" nil :argv ["/home/lex/Programme/miniconda3/envs/tf/bin/python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t)) eieio--unbound #s(jupyter-server "http://localhost:8888" "ws://localhost:8888" t (#s(hash-table size 1 test eql weakness value rehash-size 1.5 rehash-threshold 0.8125 data (t #2))) #s(jupyter-server-ioloop (#<finalizer>) #<process zmq<1>> nil ((disconnect-channels (kernel-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (jupyter-server-ioloop--recv-messages) (when ws (jupyter-server-ioloop--disconnect ws)) (list 'disconnect-channels kernel-id)))) (connect-channels (kernel-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (unless ws (url-cookie-parse-file) (jupyter-server-ioloop--connect kernel-id))) (jupyter-server-ioloop--recv-messages) (list 'connect-channels kernel-id))) (send (kernel-id channel msg-type msg msg-id) ((let ((ws (jupyter-server-ioloop--kernel-ws kernel-id))) (unless ws (error "Kernel with ID (%s) not connected" kernel-id)) (websocket-send-text ws (jupyter-encode-raw-message (plist-get (websocket-client-data ws) :session) msg-type :channel (substring (symbol-name channel) 1) :msg-id msg-id :content msg)) (jupyter-server-ioloop--recv-messages) (list 'sent kernel-id channel msg-id))))) ((jupyter-api-with-subprocess-setup (require 'jupyter-server-ioloop) (push 'jupyter-server-ioloop--recv-messages jupyter-ioloop-pre-hook) (setq jupyter-server-timeout (/ jupyter-ioloop-timeout 4) jupyter-ioloop-timeout (* 3 (/ jupyter-ioloop-timeout 4))) (setq jupyter-server-rest-client (jupyter-rest-client :url "http://localhost:8888" :ws-url "ws://localhost:8888" :auth 'nil)))) nil "http://localhost:8888" "ws://localhost:8888" nil) (:default "python3" :kernelspecs (("python3" nil :argv ["/home/lex/Programme/miniconda3/envs/tf/bin/python" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3 (ipykernel)" :language "python" :interrupt_mode "signal" :metadata (:debugger t))))) "71b07ae7-822a-4f8d-8876-0328bf319fce"))))

All this while jupyter-use-zmq is in deed nil.

aseltmann avatar Jun 28 '23 13:06 aseltmann