Skip to content

[Bug]: Segmentation fault on macOS when using matplotlib.pyplot.ion() in IPython #27808

Closed
@mphanderson

Description

@mphanderson

Bug summary

When using matplotlib.pyplot.ion() in an instance of IPython, after around 15-30 minutes the IPython instance will exit and "Segmentation fault 11" is printed in the terminal. This occurs with or without additional code execution or interaction with the terminal, and seems to simply happen after some amount of time.

Code for reproduction

import matplotlib.pyplot as plt

plt.ion()

Actual outcome

In [1]: import matplotlib.pyplot as plt

In [2]: plt.ion()
Out[2]: <contextlib.ExitStack at 0x102af0b50>

In [3]: Segmentation fault: 11

To be clear, IPython does not immediately segfault, it happens after upward of 15 minutes of being idle (or being used).

Expected outcome

I would expect the terminal to remain open indefinitely.

Additional information

I have reproduced this bug with both:
Python 3.11.7, IPython 8.21.0, matplotlib 3.8.3
and
Python 3.9.18, IPython 8.18.1, matplotlib 3.8.2

Both versions of Python were installed using homebrew.

  • I do not recall this happening with the previous version of Sonoma I was using (14.3).
  • I am using an M1 MacBook Pro.
  • I have tried uninstalling and reinstalling matplotlib, which made no difference.
  • My IPython instances that have not used plt.ion() do not experience this behaviour and will remain open indefinitely.

Operating system

macOS Sonoma 14.3.1

Matplotlib Version

3.8.3

Matplotlib Backend

MacOSX

Python version

3.11.7

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions