ipython: "Run All" in the notebook hangs on %matplotlib qt

This is a strange bug, but it seems reproducible across systems.

If I have a notebook where the first cell is

%matplotlib qt

And I select “Run All”, IPython executes the first cell but then hangs. The status icon in the upper right hand corner is an open circle, but I cannot run any other cells. If I add a simple print statement after the %matplotlib line, it gets executed and prints to the output zone.

This doesn’t happen if I execute the cell “manually”. Once that has happened, I can select “Run All” without problems.

This happens with IPyhton 2.0 on both OSX 10.6 and 10.8. I’m using Python 2.7, through anaconda.

Happy to try anything to track this down further…

About this issue

  • Original URL
  • State: open
  • Created 10 years ago
  • Comments: 40 (9 by maintainers)

Most upvoted comments

The problem also happens with the %gui qt magic, although I think that tries to import matplotlib under some circumstances so I am not sure.

This has nothing (directly) to do with matplotlib or magics. It is almost certainly a race condition when doing the hand off from one event loop running the show to the other.

My guess is that a similar fix to https://github.com/ipython/ipython/pull/10301/files is what is needed here.

@bilderbuchi see the original post in this issue, it’s still the same issue. Here’s a GIF of me recreating this on my machine (OSX w/ latest jupyter and qt4)

bug