Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use %matplotlib inline in ipython #9834

Open
jdidion opened this issue Aug 3, 2016 · 9 comments
Open

Unable to use %matplotlib inline in ipython #9834

jdidion opened this issue Aug 3, 2016 · 9 comments
Milestone

Comments

@jdidion
Copy link

jdidion commented Aug 3, 2016

I am using Anaconda, python 3.5.2, and ipython 5.0.0 on OSX 10.9. Strangely, 'inline' shows up as an available backend:

In [1]: %matplotlib --list
Available matplotlib backends: ['qt5', 'notebook', 'inline', 'qt', 'wx', 'qt4', 'nbagg', 'gtk3', 'tk', 'gtk', 'osx']

but when I actually try to use it, I get an error:

In [2]: %matplotlib inline
...stacktrace...
UnknownBackend: No event loop integration for 'inline'. Supported event loops are: qt, qt4, qt5, gtk, gtk2, gtk3, tk, wx, pyglet, glut, osx

The stacktrace is attached.
stacktrace.txt

@takluyver
Copy link
Member

The %matplotlib magic is shared between terminal IPython and IPython as a Jupyter kernel, so it has the same set of options. But 'inline' and 'notebook' only work when it's a Jupyter kernel. So the bug here is just that we're showing 'inline' as an option when it isn't really.

@Carreau Carreau added this to the wishlist milestone Aug 10, 2016
@NLStom
Copy link

NLStom commented Nov 24, 2016

So how can we solve this? by install some library?

@kzos
Copy link

kzos commented May 27, 2017

So, anybody got fix for this issue.?

@ScorpJD
Copy link

ScorpJD commented Jul 12, 2017

Nope, still didn't work after removing 'inline'

@BruceDai
Copy link

I met this issue on Ubuntu 16.04 LTS, and I use the workaround of https://stackoverflow.com/a/44840398, that's, not use %matplotlib inline, and add plt.show() after creation of graph.

@steowens
Copy link

steowens commented Feb 27, 2018

So I read the response and I think what it is trying to say (although it is doing a very poor job at communication), is that instead of inline you should supply the correct backend on the command.
So instead of:
%matplotlib inline
You could try:
%matplotlib osx

At least on my mac the above works without error. Not that I can say that it does anything, but it doesn't choke.
If they wanted to provide a clear and meaningful error message then they might have said something like:
UnknownBackend: No event loop integration for 'inline'. Instead of 'inline' try using one of the supported event loops: qt, qt4, qt5, gtk, gtk2, gtk3, tk, wx, pyglet, glut, osx

@lloyd5389
Copy link

I faced the same issue when testing this on a windows10 vm while checking the install of an exiftool. IPython was choking on %matplotlib inline and dumping this error:
UnknownBackend: No event loop integration for 'inline'. Supported event loops are: qt, qt4, qt5, gtk, gtk2, gtk3, tk, wx, pyglet, glut, osx
So I tried embedding the Tkinter Canvas instead %matplotlib tk as it was a Supported event loop per the error message, and it worked. Thanks for the comment @steowens

@AbdelrhmanElmhdy
Copy link

You can use pylab mode in ipython. Simply run ipython --pylab in the terminal. That will launch ipython configured to be able to support the matplotlib GUI backend

@datdinhquoc
Copy link

no solutions work, i use plt.savefig("results.png") insteead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests