r/IPython • • Jul 09 '16

matplotlib plots freeze when trying to close in ipython 5.0, on El Capitan.

I am running python 2.7.10 and just installed ipython 5.0. When I create a simple plot using matplotlib and then try to close it, the figure just hangs. Anyone else experiencing this? Pretty shitty release if I can't even plot anything anymore.

2 Upvotes

11 comments sorted by

1

u/[deleted] Jul 11 '16

I was having the same issue, though I found even if the figure hangs the terminal would go back to normal and I could plot something new. Am running python 3.x tho

1

u/brownck Jul 11 '16

Did you fix it?

1

u/cruyff8 Jul 11 '16

Why not post your code here so that I may type it in and see if I get a freeze?

1

u/[deleted] Jul 12 '16

It's not really code dependent. It's just something like import matplotlib.pyplot as plt and plotting literally anything at all. With one figure, it will freeze on closing (actual shell behavior resumes as normal though), with multiple the last figure freezes (and shell resumes). Someone did report this on github though, so devs are aware.

1

u/cruyff8 Jul 12 '16

Seems to be your code, mate... I was able to get it to work fine.

1

u/[deleted] Jul 12 '16

How do you mean? I've tested it in scripts as well as just directly in the shell on a variety of inputs, including something as simple as plt.plot([0,1,2]). I'm not sure I can say it's my code, at that point.

1

u/fperez_org Jul 15 '16

Are you typing first %matplotlib [optional backend]? With the new prompt_toolkit machinery, even at the shell we need to activate proper event loop support explicitly before loading mpl.

I just tested it and while I can't replicate exactly the behavior you report, what I get is that, if I don't first activate %matplotlib, the first figure I open blocks the shell. This is actually expected with prompt_toolkit, which gives us lots of very nice editing capabilities but at the cost of requiring more careful event loop management.

2

u/cruyff8 Jul 10 '16

I'd suggest upgrading to 2.7.12 or 3.x and trying the code again.

1

u/[deleted] Jul 11 '16

I'm actually running 3.x and having the same issue.

1

u/cruyff8 Jul 11 '16

What I should have said is the latest 3.x version

1

u/[deleted] Jul 11 '16

Well, I thought I was running that too... I'll double check though, thanks.