emacs-jupyter / jupyter

An interface to communicate with Jupyter kernels.
GNU General Public License v3.0
914 stars 89 forks source link

zmq-process-error wrong-type-argument (only on emacs-plus@30, not emacs-plus@29) #540

Closed delnatan closed 1 month ago

delnatan commented 1 month ago

thanks for this awesome package! I've been using it for a few months now on my Mac and things were running smoothly (running emacs-plus@29). I recently switched to emacs-plus@30 and running jupyter-run-repl gives me a zmq-process-error. When I run make test in the repo folder ~/.emacs.d/straight/repos/emacs-zmq/. I get:

emacs -nw -Q -batch -L . -l ert -l zmq-tests.el \
        --eval "(ert-run-tests-batch-and-exit)"
Loading /Users/delnatan/.emacs.d/straight/repos/emacs-zmq/emacs-zmq (module)...
ZMQ Version: 4.3.1
Running 12 tests (2024-06-07 11:54:30-0700, selector ‘t’)
Checking for compatible module binary to download
Test zmq--download-module backtrace:
  signal(ert-test-failed (((should (zmq--download-module (concat "tags
  ert-fail(((should (zmq--download-module (concat "tags/" zmq-emacs-ve
  (if (unwind-protect (setq value-507 (apply fn-505 args-506)) (setq f
  (let (form-description-509) (if (unwind-protect (setq value-507 (app
  (let ((value-507 'ert-form-evaluation-aborted-508)) (let (form-descr
  (let* ((fn-505 #'zmq--download-module) (args-506 (condition-case err
  (let ((zmq-emacs-version "v0.10.10") (noninteractive t) (default-dir
  (unwind-protect (let ((zmq-emacs-version "v0.10.10") (noninteractive
  (let ((tempdir (make-temp-file "zmq--download-module" t))) (unwind-p
  #f(lambda () [t] (let ((value-503 (gensym "ert-form-evaluation-abort
  #f(compiled-function () #<bytecode 0x1ede3b26d2566625>)()
  handler-bind-1(#f(compiled-function () #<bytecode 0x1ede3b26d2566625
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name zmq--download-module :documentation n
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [... ... ...
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  eval((ert-run-tests-batch-and-exit) t)
  command-line-1(("-L" "." "-l" "ert" "-l" "zmq-tests.el" "--eval" "(e
  command-line()
  normal-top-level()
Test zmq--download-module condition:
    (ert-test-failed
     ((should (zmq--download-module (concat "tags/" zmq-emacs-version)))
      :form (zmq--download-module "tags/v0.10.10") :value nil))
   FAILED   1/12  zmq--download-module (0.399028 sec) at zmq-tests.el:437
   passed   2/12  zmq-close-socket-once (0.000368 sec)
   passed   3/12  zmq-contexts (0.000118 sec)
   passed   4/12  zmq-encryption (0.000051 sec)
   passed   5/12  zmq-globrefs (0.268931 sec)
   passed   6/12  zmq-messages (0.001654 sec)
   passed   7/12  zmq-polling (2.015512 sec)
   passed   8/12  zmq-send-unicode (0.000033 sec)
   passed   9/12  zmq-sockets (0.002984 sec)
error in process filter: Error in ZMQ subprocess: wrong-type-argument, (listp #[nil ((if zmq-current-context (prin1 (cons 'test-result "context")) (prin1 (cons 'test-result "no context"))) (zmq-flush 'stdout)) nil])
make: *** [test] Error 255

In my other M1 macbook running MacOS 14.5 (Sonoma), but emacs-plus@29 (v29.3), the tests went through OK (except zmq--download-module erroring also). Both emacs were installed using --with-native-comp flags.

Is anyone else having the same issue? I tried to look for related errors but can't seem to find anything. I'm curious to find out what's different between v29 vs. v30 that may cause this error.

mk0417 commented 1 month ago

I experienced similar issue on emacs 30. I had a look emacs-mirror on github and I guess the problem is caused by the commit of f2bccae on 28 April 2024. It has no problem if I build emacs 30 with the previous commit.

delnatan commented 1 month ago

Thanks for the pointer! I've verified this too! I installed commit 1e931f1, which is a couple commits before f2bccae, and have no problems. I don't even know how I would've looked through all those commits! thanks for finding this

Thankfully there's a convenient way to do this by just adding: export HOMEBREW_EMACS_PLUS_30_REVISION=1e931f1

in the .bashrc or .zshrc depending on whichever shell being used. Then re-install emacs-plus@30 with the usual formula.

I updated to v30 for other reasons but didn't expect emacs-jupyter to break.. I'm going to close this issue because v30 is not stable. Time to learn more emacs lisp :)