jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.68k stars 4.93k forks source link

asyncio.sleep hangs with matplotlib qt5 #4895

Open rj380cam opened 5 years ago

rj380cam commented 5 years ago

This cell will not finish

%matplotlib qt5
import asyncio
await asyncio.sleep(1)
print("done")

Except if the other cell is run:

import matplotlib.pyplot as plt
plt.figure()
asvetlov commented 4 years ago

I guess https://github.com/harvimt/quamash event loop should be used to run both Qt and asyncio code.

pwuertz commented 4 years ago

@rj380cam I'm seeing this problem too. Executing the first cell seems to hang forever, but executing any other cell (no matter the content) continues normal operation.

You can even repeat await asyncio.sleep(1); print("done") and all of them execute normally once the initial await is "triggered" by executing another cell ^^