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

AnyIO commit breaks Matplotlib display in separate windows #1235

Open
ianthomas23 opened this issue May 3, 2024 · 2 comments · Fixed by #1265
Open

AnyIO commit breaks Matplotlib display in separate windows #1235

ianthomas23 opened this issue May 3, 2024 · 2 comments · Fixed by #1265

Comments

@ianthomas23
Copy link
Collaborator

With the commit before the AnyIO PR on the main branch (830829f) and using ipython 8.23.0 and matplotlib 3.8.4, the displaying of Matplotlib plots in separate windows (e.g. with qt backend) using jupyter works fine. With the AnyIO commit (772dfb8) onwards the plot windows are no longer displayed.

Code to reproduce (I've been using jupyter qtconsole but jupyter lab, etc, all show the same):

%matplotlib qt
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 3, 2])

In ipython the same example works fine.

@davidbrochart
Copy link
Collaborator

Probably because of external event loop integration.

@ianthomas23
Copy link
Collaborator Author

enter_eventloop is only ever called if kernel.eventloop is set at startup:

async def main(self):
async with create_task_group() as tg:
if self.kernel.eventloop:
tg.start_soon(self.kernel.enter_eventloop)
tg.start_soon(self.kernel.start)

If the eventloop is set later, e.g. via %matplotlib qt, it is never called.

Plus there are 7 uses of kernel.shell_stream in eventloops.py and the shell_stream was replaced with shell_port in the AnyIO changes. So evidently this code isn't covered by any ipykernel tests.

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

Successfully merging a pull request may close this issue.

3 participants