4

I am trying to enable the python notebook in emacs. I am following the instruction from this page: https://realpython.com/blog/python/emacs-the-best-python-editor/

When I tried to do "%matplotlib inline" so that I can show the plot inline, I got the following errors:

"UnknownBackend: No event loop integration for u'inline'. Supported event loops are: qt, qt4, qt5, gtk, gtk2, gtk3, tk, wx, pyglet, glut, OSX"

My emacs is 24.4 and jupyter notebook version is 4.3

Thanks

5
  • do you have matplotlib installed? what kernel in ein? it is really simple if you have anaconda and run anaconda mode Commented Mar 18, 2018 at 22:44
  • Hi, I am having the same problem in my terminal... may be it could be this stackoverflow.com/questions/42616768/… Commented Mar 19, 2018 at 0:50
  • @manandearth, yes, I installed the anaconda to include the matplotlib library. How can I check the kernel version ein? My matplotlib version is 2.0.2 Commented Mar 22, 2018 at 7:43
  • @AnselmScholz, Thanks! I saw this post before but since I tried to use emacs as my single editor where I want to run the notebook, I am trying not to switch to another editor. Do you see that is possible still? Commented Mar 22, 2018 at 7:53
  • when you start a new notebook you can choose which kernel in the ein:notebooklist-open menu, a kernel in an open notebok can be altered or stopped or restarted ( very easily in the gui version just click on the kernel name, or go through the M-x ein:... commands. look also in emacs ipython documentation Commented Mar 22, 2018 at 9:56

1 Answer 1

4

If you are running matplotlib on osx this helped resolve my problem:

  1. I upgraded to matplotlib-2.2.0 by now there is a new version 2.2.0
  2. Import matplotlib
  3. calling matplotlib.use('TkAgg') directly after the import of matplotlib.(comments
  4. importing pyplot
  5. call pyplot.plot().
  6. call %matplotlib osx

I had to call %matplotlib osx instead of %matplotlib inlineone of the comment mentiond it

After that it worked.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Anselm. If I understand you correctly, your steps are:<br/> 1. upgrade matploblib-2.2.0<br/> 2. %matplotlib osx<br/> 3. import matplotlib<br/> 4. matploblib.use('TkAgg')<br/> 4. import matplotlib.pyplot as plt<br/> 5. plt.plot()<br/> Is it correct?
Hi Minghui Liu, I edited my answer as it was not very clear... I hope it is better now.
Step 6 got it for me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.