Skip to content

[Bug]: [Jupyter][Windows] Axes.bar() causes the Jupyter kernel to terminate with no traceback #32218

Description

@L-zys

Bug summary

Description

I found a reproducible issue where Axes.bar() causes the Jupyter kernel to terminate on Windows.

The same plotting operation works normally in a standalone Python process using the same Conda environment.

Environment

  • OS: Windows x64
  • Python: 3.12.13
  • Matplotlib: 3.11.1
  • NumPy: 2.5.2
  • IPython: 9.16.1
  • ipykernel: 7.3.0
  • pyzmq: 27.1.0
  • FreeType: 2.14.3
  • Installation: Miniforge / conda-forge

Python executable:

E:\Software\miniforge3\envs\optimization\python.exe

Minimal reproduction

In a fresh Jupyter notebook using the Python (optimization) kernel:

import matplotlib
import matplotlib.pyplot as plt

print("Matplotlib:", matplotlib.__version__)

fig, ax = plt.subplots()

print("before bar")

ax.bar(
    [1, 2, 3],
    [1, 2, 3]
)

print("after bar")

plt.close(fig)

### Code for reproduction

```Python
import matplotlib
import matplotlib.pyplot as plt

print("Matplotlib:", matplotlib.__version__)

fig, ax = plt.subplots()

print("before bar")

ax.bar(
    [1, 2, 3],
    [1, 2, 3]
)

print("after bar")

plt.close(fig)

Actual outcome

Matplotlib: 3.11.1
before bar

Expected outcome

Matplotlib: 3.11.1
before bar
after bar

Additional information

The issue occurs when running Matplotlib in a Jupyter kernel on Windows.

In the same Jupyter kernel, the following operations work normally:

  • importing matplotlib.pyplot
  • creating a figure with plt.figure() / plt.subplots()
  • ax.plot()
  • ax.scatter()
  • plt.close()

However, ax.bar() causes the Jupyter kernel to terminate immediately, without a Python exception or traceback.

I also tested the non-interactive "Agg" backend in Jupyter, and ax.bar() still caused the kernel to terminate.

In contrast, the same bar() operation works normally when executed from a standalone Python process using the same Conda environment.

I have not tested an earlier Matplotlib version yet, so I cannot confirm whether this is a regression.

I do not know the cause or a fix yet.

Operating system

Windows 11 x64

Matplotlib Version

3.11.1

Matplotlib Backend

qtagg

Python version

3.12.13

Jupyter version

4.6.3

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions