Skip to content

[Bug]: show(block=False) freezes #28324

Closed

Description

@mrrezaie

Bug summary

Hi, I know that this topic was addressed multiple times on stackoverflow.com, but nothing worked for me. I used to use this method for almost 5 years, but my recent new installation causes this issue. Any help is greatly appreciated.

Code for reproduction

import matplotlib.pyplot as plt 
plt.plot([1,2,3,5])
plt.show(block=False)

Actual outcome

A new empty and frozen window. Force closing this window interrupts my iPython console as well.

Expected outcome

A new working window, I could keep working with the iPython console.

Additional information

I installed pyqt6 for the backend.

Operating system

Windows 10 and 11

Matplotlib Version

3.9.0

Matplotlib Backend

qtagg

Python version

3.10.14

Jupyter version

iPython 8.24.0

Installation

pip

Activity

  1. ianthomas23 commented on May 31, 2024

    @ianthomas23
    Member

    This is indeed a bug that I can reproduce on Linux, macOS and Windows. It only appears if using both matplotlib >= 3.9.0 and ipython >= 8.24.0. There have been some significant changes behind the scenes in how Matplotlib backends are handled by IPython, and I am not surprised that some use cases have been broken by it.

    I will investigate and write a fix, which may be in either Matplotlib, IPython, or both. The bug only appears using block=False and the default Matplotlib backend (which can vary according to OS and what backends are installed). The workaround in the short term is to specify the backend when starting IPython, either use

    ipython --matplotlib=qt

    or just start ipython and then use

    %matplotlib qt
    
  2. mrrezaie commented on May 31, 2024

    @mrrezaie
    Author

    @ianthomas23, I appreciate your response and the workaround; it also works well for tkagg, which I always have had problem with, by ipython --matplotlib=tk or %matplotlib tk. Thanks a lot.

  3. added this to the v3.9.1 milestone on May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions