Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong type argument: "Not a valid client", nil, jupyter-current-client #546

Open
majukano opened this issue Jul 3, 2024 · 3 comments
Open

Comments

@majukano
Copy link

majukano commented Jul 3, 2024

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?

@gmoutso
Copy link

gmoutso commented Jul 4, 2024

If I replicate your steps, things work:

  1. open a python file
  2. run jupyter-run-repl or jupyter-server-run-repl, select environment etc..
  3. a REPL buffer pops up.
  4. At this point both python buffer and jupyter repl buffer have jupyter-repl-interaction-mode enabled and the python buffer already has been associated with the kernel of the REPL.
  5. If I do jupyter-rep-associate-buffer nevertheless, 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.

@majukano
Copy link
Author

majukano commented Jul 5, 2024

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)

@gmoutso
Copy link

gmoutso commented Jul 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants