jupyter
jupyter copied to clipboard
Wrong type argument: "Not a valid client", nil, jupyter-current-client
Hello everyone,
I hope someone can help me. I am trying to work in emacs-jupyter with REPL-client.
If I run M-x jupyter-run-repl I can select one of the installed kernels and a new Ipython buffer opens:
Launching org_test kernel...
Starting org_test kernel process...done
Launching org_test kernel...done
Requesting kernel info...done
However, if I then execute M-x jupyter-interaction-mode in the original buffer and then try to send code with C-c C-c I get:
"Wrong type argument: "Not a valid client", nil, jupyter-current-client"
Interestingly, when I try to establish a connection with M-x jupyter-rep-associate-buffer, no client is recognised and a new one is opened into which I cannot write with the same error.
When I select a connection file with M-x jupyter-connect-repl a new ipython buffer opens with "Requesting kernel info...done" When I try to transfer code, jupyter-current-client is still nil. (same error)
When I work with org-mode code-blocks and select a kernel, emacs-jupyter works fine.
What information is needed to narrow down the problem?
If I replicate your steps, things work:
- open a python file
- run
jupyter-run-replorjupyter-server-run-repl, select environment etc.. - a REPL buffer pops up.
- At this point both python buffer and jupyter repl buffer have
jupyter-repl-interaction-modeenabled and the python buffer already has been associated with the kernel of the REPL. - If I do
jupyter-rep-associate-buffernevertheless, only the sole existing repl is provided for selection (and when I do nothing changes).
Try toggle-debug-on-error to see maybe an error throws. If I do this, no errors come up.
Hello gmoutso, thank you for your message! You are right when I execute C-c C-c an error is reported. Unfortunately I have no idea what could be the reason for this.
Debugger entered--Lisp error: (wrong-type-argument "Not a valid client" nil jupyter-current-client)
signal(wrong-type-argument ("Not a valid client" nil jupyter-current-client))
#f(compiled-function (str &optional insert beg end) "Evaluate STR using the `jupyter-current-client'." #<bytecode -0x196fb04b5f13dc8f>)("print(\"hallo\")" nil 8 22)
apply(#f(compiled-function (str &optional insert beg end) "Evaluate STR using the `jupyter-current-client'." #<bytecode -0x196fb04b5f13dc8f>) ("print(\"hallo\")" nil 8 22))
jupyter-eval-string("print(\"hallo\")" nil 8 22)
jupyter-eval-region(nil 8 22)
jupyter-eval-line-or-region(nil)
funcall-interactively(jupyter-eval-line-or-region nil)
command-execute(jupyter-eval-line-or-region)
Hi Majukano. I can't think of a reason the jupyter-current-client is nil.
Do you run jupyter-run-repl from a python-mode buffer that is visiting a saved file? If so, both jupyter-current-client and jupyter-repl-interaction-mode should be set and non-nil. No further action required. If not, then a REPL will be popped up but the aforementioned variables remain nil and won't be set.
Try also jupyter-use-zmq set to nil and jupyter-run-repl or run a jupyter server separately from a CLI and then the jupyter-server-run-repl alternative. I don't see how this relates to you since the REPL does get run, but I have found zmq troublesome (it needs to be build on my machine with local glib) and find a running server that I have set up more direct.
Check for any suspicious messages in the messages buffer. Try the most minimal setup for python-mode and jupyter. What emacs version are you using (mine is 29.4 but 28 worked fine too)? I assume you are using the latest jupyter. Perhaps package-delete and reinstall might fix things.