-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
[Bug]: Possible issue with Matplotlib 3.9.1 wheel on Windows only #28551
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
[Bug]: Possible issue with Matplotlib 3.9.1 wheel on Windows only #28551
Comments
I suppose the first stage here is to confirm if any other Matplotlib devs can reproduce this on Windows. |
Hi Ian |
I can't reproduce b.c I keep getting this error when trying to install nightly: ERROR: Could not find a version that satisfies the requirement numpy>=1.23 (from contourpy) (from versions: 2.1.0.dev0)
ERROR: No matching distribution found for numpy>=1.23 |
@story645 I use something like this: python -m pip install "matplotlib==3.9.1"
python -m pip install --only-binary=:all: --pre --upgrade --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple contourpy to give matplotlib 3.9.1, numpy 2.0.0 and contourpy 1.3.0.dev1 |
Thanks @ianthomas23 and ran your code and can reproduce:
|
I've created a repo to demonstrate this at https://github.com/ianthomas23/mpl-test. If you look at the github action run https://github.com/ianthomas23/mpl-test/actions/runs/10079751371 you'll see that it uses the reproducer code from above both with and without the matplotlib import for various combinations of mpl and contourpy versions. The interesting addition is a run that builds mpl 3.9.1 from source using MSVC and this passes the tests, compared to the official wheel (built using the |
I am very happy that I stumbled over this issue because since two weeks, also the CI pipeline for one of our open-source projects fails on windows without any (useful) error message (see, e.g., https://github.com/cda-tum/mqt-predictor/actions/runs/9824223458/job/27126370262). I just wanted to mention it, seems like we ran into the same issue as you did. |
I have labelled this "release critical" as there is evidence of 3 downstream libraries suffering crashes on Windows using Matplotlib 3.9.1, so it is not specific to ContourPy. I need help with this. |
So to summerize:
Given that locally built wheels work I suspect that this is not a problem in Matplotlib source, but is something is the build process. My two suspicions are:
It looks like delvewheel had releases on April 17 (1.6.0), Jun 20 (1.7.0) and July 3 (1.7.1). We did 3.9.1 on July 4 and 3.9.0 on May 15 so that means we likely got delvewheel 1.6.0 for mpl3.9.0 and 1.7.1 for mpl3.9.1. It looks like pybinb11 had release on Mar 27 (2.12.0), Jun 25 (2.13.0) and Jun 26 (2.13.1) which means we likely got 2.12.0 for mpl3.9.0 and 2.13.1 for mpl3.9.1. However, given that locally built wheels work (and CI has kept working), I am a bit skeptical that it is pybind11 alone. However, I do have some concern that there could be some interaction between c-extensions using pybind11 with different versions of pybind11 conflicting with each other. I have never seen any discussion of this being a concern and I trust the pybind11 devs that if this were a known issue they would make it well known, but I do not actually understand how pybind11 works well enough to to explain why it is not a possible problem so would like my assumption checked. Open technical question:
Open policy question:
I'm going to put this on our meeting agenda for the call today. |
No, matplotlib 3.9.1 from conda-forge and contourpy 1.3.0.dev1 nightly wheel (a conda/pip combination I wouldn't normally recommend) works for me locally. |
Some other thoughts:
|
See matplotlib#28551 for details
The dll that is added by delvewheel is identical between mpl 3.9.0 and mpl 3.9.1, which makes it hard to point to that as the problem source... As is the patch inserted in Looking at the commits to delvewheel between the two versions indicates the addition/renaming of two cli args, which we do not use and are not turned on by default, testing/doc changes, and support for 3.13 (which is just adding the build tags to a list of available tags). None of these seem likely to me to cause differences in behavior that would be more subtle than are ruled out by checking the dll hashes. Therefore I am reasonably convinced delvewheel is not the culprit, at least not on its own/the build chain change that directly caused the problem. However, that is the biggest difference between the wheels as uploaded to pypi and the wheel that you build by default, so I mean that leaves some room for pybind11 (/mixing pybind11 and non-pybind11) but not a whole lot of room. |
On a completely fresh Windows 10 VM with only Python 3.12 installed, trying to import |
Looking at the file in Dependency Walker, it appears that the |
I guess there is not much too add by saying this, but iminuit is also affected, which in turn is used by many other libraries scikit-hep/iminuit#1018 |
Can someone test the wheels generated by https://github.com/matplotlib/matplotlib/actions/runs/10204731582?pr=28635 and https://github.com/matplotlib/matplotlib/actions/runs/10204565050?pr=28637 ? We earlier confirmed that pinning delvewheel back does not fix the problem. |
This is worth investigating, but it is a distraction from the actual problem:
|
It didn't fix the problem. |
There is progress to report here, but accidental. Reproducers that failed for me 15 hours ago are now passing. If you look at the last 2 GHA runs of my So as of now I can use the Matplotlib nightly wheel without problems on Windows, but not 3.9.1. I've run the full ContourPy test suite on this (contourpy/contourpy#413) to confirm this. If I was to exclude use of Matplotlib 3.9.1 on Windows all CI runs would pass. What is the difference between the 3.9.1 and nightly wheels? The I don't know the cause of the problem, but I suspect it relates to a problem that consumed lots of developer time a couple of months ago when the Windows github runner shipped MSVC runtimes that weren't fully back/forward compatible. There are many issues about this e.g. actions/runner-images#10055. I suspect that Matplotlib 3.9.1 was shipped after being built on one of these less-than-ideal images. The problem was supposed to be fixed but given the amount of ongoing chat about this I suspect it wasn't. Perhaps we were just unlucky in timing then, and are now lucky that the runner images have been updated. I propose the following plan:
For item 2 for downstream projects (possibly @BertJorissen, @nquetschlich and @HDembinski) you can try out the nightly wheels instead of Matplotlib 3.9.1 by using the following in your CI runs between your build and test stages: python -m pip install --only-binary=:all: --upgrade --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple matplotlib |
Thank you for fixing this so quickly! I did have |
This is a combination of the GitHub runner environment, and security changes in Python. On the runners, the mingw compilers are available on the I did manage to find and fix a few warnings while debugging this, which are in #28682. I also prepared a job with extra debugging; from there I see we load:
And surprisingly, this is where we crash, sometime after locating |
In case it helps, I originally debugged the crashes on the GitHub runners due to the Microsoft STL update in my own application (unrelated to Python/Matplotlib) by creating crash dumps via procmon and uploading them as artifacts. See here for an example. The crash dumps can be opened in Visual Studio or WinDbg. |
3.9.2 is tagged now, and I confirmed that the wheels worked on Windows again via @BertJorissen's workflow, so pushed them to PyPI. As #28687 was also confirmed to work by @ianthomas23, I'm to close this issue, hopefully for good this time. |
bug on windows in ci (matplotlib/matplotlib#28551)
On github actions, on windows, using pypy3 and matplotlib 3.9.2, I get what seems to be the same error. Oddly though, I only get the error on certain repos of mine that use matplotlib, and not others:
|
@jfuruness I suspect your issues is that you are using pypy310 which we do not provide wheels for (yet) and something is going wrong with your local build. Please see the install docs on building from source on windows. |
@tacaswell Ah I didn't realize, thank you for the explanation. Looking at a few of the past prior releases I don't see wheels for pypy310, is there a plan to add these in the future (and perhaps a gh issue I could follow)? |
We were waiting for NumPy wheels numpy/numpy#24728; it looks like those are out, but they didn't close the issue, so I wasn't notified. |
@QuLogic Ah makes sense, sounds good! Thank you both for you support of matplotlib! |
Because it has issue on windows matplotlib/matplotlib#28551
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
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
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
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 install
ing into python-onlyconda
environments, i.e.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
The text was updated successfully, but these errors were encountered: