Skip to content

[Bug]: Possible issue with Matplotlib 3.9.1 wheel on Windows only #28551

Closed
howsoai/howso-engine-recipes
#153
@ianthomas23

Description

Bug summary

Since the release of Matplotlib 3.9.1 I have been experiencing CI failures on ContourPy on Windows only that did not occur with Matplotlib 3.9.0. There is some info in my PR contourpy/contourpy#406 that works around it by pinning matplotlib<3.9.1 on Windows. I am not really sure what the problem is, but I now have a simple reproducer.

Code for reproduction

from contourpy import contour_generator
import matplotlib.pyplot as plt

print("START")
cont_gen = contour_generator(z=[[0, 1], [2, 3]])
try:
    cont_gen.filled(2.0, 1.0)
except Exception as e:
    print("EXCEPTION HANDLER", e)
print("END")

Actual outcome

If you run the above code with matplotlib 3.9.1 and contourpy 1.2.1 (the latest releases) it works OK with correct output of

START
EXCEPTION HANDLER upper_level must be larger than lower_level
END

Note the code imports some of matplotlib but does not use it, and the contourpy code here does not use it either.

If you use matplotlib 3.9.1 or nightly wheel and contourpy nightly wheel then it silently crashes for me with just

START

But if you comment out the import matplotlib... line it works OK again. Use of matplotlib 3.9.0 and any contourpy (1.2.1 or nightly wheel) is always OK.

For my installations here I am pip installing into python-only conda environments, i.e.

conda create -n temp python=3.12
conda activate temp
pip install matplotlib contourpy

Expected outcome

See above.

Additional information

There is a relevant post by @BertJorissen on the pybind11 gitter which has some in-depth analysis and leads me to believe that this is not just a ContourPy problem.

Operating system

Windows only

Matplotlib Version

>= 3.9.1

Matplotlib Backend

No response

Python version

I see same results for python 3.8 to 3.12.

Jupyter version

No response

Installation

pip

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions