Open ricardog opened 4 years ago
This seems to be caused by using use-package
for configuration. When I start emacs -q
and evaluate the following
(require 'package)
(setq package-user-dir reg-package-dir)
(package-initialize)
(require 'use-package)
(use-package jupyter
:ensure t
:defer nil
:requires org
:init
(setq jupyter-api-authentication-method 'token
jupyter-eval-use-overlays t
org-babel-default-header-args:jupyter-python '((:async . "yes")
(:kernel . "python3")))
)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(python . t)
(jupyter . t)
))
Execution of source code blocks fails with the error above. I only have the following packages in package-user-dir
total used in directory 16 available 41466000
drwxr-xr-x 31 ricardog staff 992B Jul 22 09:38 .
drwxr-xr-x 4 ricardog staff 128B Jul 22 09:29 ..
drwxr-xr-x 4 ricardog staff 128B Jul 15 16:11 archives
drwxr-xr-x 6 ricardog staff 192B Jul 15 16:11 bind-key-20191110.416
drwxr-xr-x 69 ricardog staff 2.2K Jul 15 16:18 jupyter-20200417.1907
drwxr-xr-x 6 ricardog staff 192B Jul 15 16:15 simple-httpd-20191103.1446
-rw-r--r-- 1 ricardog staff 154B Jul 15 16:14 spinner-1.7.3.signed
-rw-r--r-- 1 ricardog staff 154B Jul 15 16:14 undo-tree-0.7.4.signed
drwxr-xr-x 22 ricardog staff 704B Jul 15 16:11 use-package-20200629.1856
drwxr-xr-x 6 ricardog staff 192B Jul 15 16:15 websocket-20200419.2124
drwxr-xr-x 10 ricardog staff 320B Jul 15 16:18 zmq-20200305.2345
However, when I start emacs -q
and eval this bit of code
(add-to-list 'load-path "~/_emacs.d/.packages/26.3/elpa/jupyter-20200417.1907")
(add-to-list 'load-path "~/_emacs.d/.packages/26.3/elpa/simple-httpd-20191103.1446")
(add-to-list 'load-path "~/_emacs.d/.packages/26.3/elpa/websocket-20200419.2124")
(add-to-list 'load-path "~/_emacs.d/.packages/26.3/elpa/zmq-20200305.2345")
(load-library "jupyter")
(load-library "jupyter-tramp")
(load-library "org")
(setq jupyter-api-authentication-method 'token
jupyter-eval-use-overlays t
org-babel-default-header-args:jupyter-python '((:async . "yes")
(:kernel . "python3")))
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(python . t)
(jupyter . t)
))
Source code block execution works correctly.
Any thoughts on why use-package
breaks jupyter-emacs
?
Thanks.
I had the same problem with my running config, both of your emacs -q
-versions worked fine though. Your second example lead me to add
(use-package jupyter-tramp)
to my config which solved this problem for me. Maybe that helps in your case too.
Thanks for the pointer @fritz-k . Unfortunately that didn't solve the problem for me. I'll keep looking.
Too bad. Two other things I could imagine are the load order and the :requires org
.
In your plain example the load order is jupyer -> jupter-tramp -> org
in the use-package case it's (implicitly due to :requires org
) org -> jupyter
.
:requires
simply doesn't load the package if the dependency isn't available, but doesn't change the load order.
Here's the config I use , maybe that helps:
(use-package jupyter
:after (ob-jupyter ob-python)
:config
(setq jupyter-api-authentication-method 'token)
(setq org-babel-default-header-args:jupyter-python '((:session . "/jpy::py")
(:kernel . "python3")
(:async . "yes")))
(add-to-list 'org-structure-template-alist '("jp" . "src jupyter-python")))
(use-package jupyter-tramp)
(use-package ob
:after (org)
:config
(setq org-confirm-babel-evaluate nil
org-src-tab-acts-natively t
org-src-preserve-indentation t)
:custom
(org-babel-load-languages '((emacs-lisp . t)
(latex . t)
(shell . t))))
(use-package ob-jupyter
:after (ob))
(use-package ob-python
:after (ob)
:config
(add-to-list 'org-structure-template-alist '("p" . "src python"))
(setq org-babel-default-header-args:python '((:session . "py")
(:kernel . "python3")
(:async . "yes"))))
(I'm not 100% sure both these ob-*
are required, but IRC they add the relevant languages to org-babel-load-languages
)
I am also experiencing this error, but I'm using straight and use-package so the setup is somewhat different.
I just had this error, and fixed by changing server port, it seems token is remembered by jupyter and I'm looking for ways to change it
I just tried using a different port and it did resolve it. I haven't tried changing my init config yet.
When I try to execute an org-mode code block using a remote server session I get the following error
jupyter-ioloop-alive-p: Wrong type argument: jupyter-ioloop, unbound, ioloop
The kernel starts on the server and I can connect a REPL to it. Every time I try to execute the source block a new kernel starts. I can see them by running
jupyter-server-list-kernels
.Emacs is running on macOS. The server runs in a container on Linux. I can successfully execute org-mode code blocks when I run Emacs on a different host.
I enabled
jupyter--debug
but it didn't print anything insightful (or maybe anything at all). Below is the emacs-lisp stack trace at the time of the error.Emacs version
GNU Emacs 26.3 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 158 AppKit 1561.61) of 2020-05-04
Backtrace