I am getting this error when executing any source ipython block such as this one:

#+BEGIN_SRC ipython :session :results output drawer

# Compute areas and colors
import numpy as np
import matplotlib.pyplot as plt

N = 150
r = 2 * np.random.rand(N)
theta = 2 * np.pi * np.random.rand(N)
area = 200 * r**2
colors = theta

ax = plt.subplot(111, projection='polar')
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)


There was a fatal error trying to process the request. See ob-ipython-debug


 File "/Users/USER/.emacs.d/elpa/ob-ipython-20180113.929/client.py", line 1, in <module>
    import jupyter_client as client
ImportError: No module named jupyter_client

I don't know what can be wrong (I have all the necessary dependencies requires like ipython, jupyter, python, and obviously ob-ipython). Any help appreciated.

Thanks, EG

  • BTW, the ob-ipython-debug says: Traceback (most recent call last): File "/Users/USER/.emacs.d/elpa/ob-ipython-20180113.929/client.py", line 1, in <module> import jupyter_client as client ImportError: No module named jupyter_client" – Emmanuel Goldstein Jan 31 '18 at 15:31
  • Can you post the part of the .emacs related with your babel configuration? – Dox Jan 31 '18 at 16:05
  • Sure, but I don't think it's related to babel (org-babel-do-load-languages 'org-babel-load-languages '((matlab . t) (python . t) (ipython . t) ;(emacs-lisp . t) ;(shell . t) ;(matlab . t) ;(dot . t) ;(R . t) )) – Emmanuel Goldstein Jan 31 '18 at 16:09
  • [Sorry, I don't seem to know how to format code in stackexchange] – Emmanuel Goldstein Jan 31 '18 at 16:10
  • I'm getting the same error. I've checked and the file IS there. I tried to give execution permission to the file... but I'm still getting the error. I also have the line (require 'ob-ipython) in the .emacs file. – Dox Jan 31 '18 at 16:37

On my system, this error happens because my jupyter installation is based on python3, while python-shell-interpreter in emacs is python. This can be fixed by running M-S-: (setq python-shell-interpreter "python3"). You can put this command in your init file if you only use python3.

For those on Debian/Ubuntu, this can also be fixed by installing python2.7 version of jupyter by running apt install python-jupyter-client python-jupyter-console. Note that Debian packages jupyter-* are all python3 based.

Another way to deal with this issue is by using python environments. If you're using Anaconda and installed jupyter through it, running conda activate before you start emacs should point your shell's python to conda's version.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.