Skip to content

Update minimum pybind11 to 2.13.2 #29021

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

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

ianthomas23
Copy link
Member

@ianthomas23 ianthomas23 commented Oct 25, 2024

Update minimum pybind11 to 2.13.2 as use of 2.13.1 can cause mutex problems in Python 3.13 free-threaded builds, see pybind/pybind11#5420.

It would be good to confirm exactly which version of pybind11 was used to build the matplotlib 3.9.2 cp313t wheels on PyPI. They are dated Aug 13, the same date that pybind11 2.13.2 and 2.13.3 were released. So the mpl wheels could potentially have used 2.13.1 which would be bad. The GHA run that built and uploaded the wheel is https://github.com/matplotlib/matplotlib/actions/runs/10361240538/job/28683177700 but it is not verbose enough to including the pybind11 version used.

@ianthomas23
Copy link
Member Author

I think the matplotlib 3.9.2 cp313t wheels (or at least the manylinux x86_64 one) were built using the problematic pybind11 2.13.1. If I create a new 3.13.0t virtual environment using pyenv and install the latest contourpy (1.3.0) and matplotlib (3.9.2) wheels and run some code that uses both matplotlib and contourpy:

$ PYTHON_GIL=0 python
Python 3.13.0 experimental free-threading build (main, Oct 26 2024, 16:31:15) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> plt.contour([[1,2],[3,4]], levels=5)
Floating point exception (core dumped)

If I then install the latest matplotlib nightly wheel (3.10.0.dev900+g835d5125a3) which definitely uses a later pybind11 the above code works fine and I can plt.show() successfully.

But maybe the fact that the matplotlib 3.9.2 cp313t wheels are problematic is moot. We aren't fully claiming free-threaded support until there is a matplotlib release containing PR #28819 and a kiwisolver release with the equivalent (nucleic/kiwi#186). Until then if you try to import matplotlib in a free-threaded venv you get the warning that matplotlib/kiwisolver aren't claiming they can run safely without the GIL and you have to, at your own risk, use PYTHON_GIL=0 or equivalent.

So given that matplotlib 3.10 is imminent and includes #28819 (and hopefully this PR) then I think we are OK to point users towards that release if they want free-threaded support. We can't really do a 3.9.3 release including #28819 as that would also need all of the recent pybind11 PRs which is not appropriate for a patch release.

@oscargus oscargus merged commit 61995ee into matplotlib:main Oct 27, 2024
41 of 42 checks passed
@oscargus oscargus added this to the v3.10.0 milestone Oct 27, 2024
@ianthomas23 ianthomas23 deleted the pybind11-min-2.13.2 branch October 27, 2024 08:20
@QuLogic QuLogic added the Build label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants