Enable Jupyter in Doom Emacs
tech emacsTable of Contents
There are a few adjustments needs for the default installation when using the jupyter package in Emacs. Here’s a step-by-step guide to configure it properly with Doom Emacs.
Step 1: Install the jupyter package.
Add this line to package.el
:
(package! jupyter) ;
Step 2: Enable builtin Jupyter Support in Org Mode
To enable Jupyter support in Org mode, make the following modifications in your init.el
file:
- Uncomment the
ein
line. The emacs-ipython-notebook is a dependency of jupyter package. - Add
+jupyter
to the Org settings. For more details, refer to :lang org:
(org +jupyter) ; organize your plain life in plain text
Step 3: Patch for Runtime Errors with ZeroMQ
To address a runtime error related to ZeroMQ (as discussed in this issue), append the following code to your config.el
or any other configuration file:
(defun my-jupyter-api-http-request--ignore-login-error-a
(func url endpoint method &rest data)
(cond
((member endpoint '("login"))
(ignore-error (jupyter-api-http-error)
(apply func url endpoint method data)))
(:else
(apply func url endpoint method data))))
(advice-add
#'jupyter-api-http-request
:around #'my-jupyter-api-http-request--ignore-login-error-a)
Step 4: reload the Emacs
After making these changes, reload Emacs. Doom Emacs should now install the necessary packages.
Using the Jupyter Package
To use the jupyter package, you can start an org
file, and invoke jupyter-run-repl
command, it will start a kernel for this file. The python code blocks will map to the jupyter session.
For example:
2 ** 10
1024