libint
libint copied to clipboard
python 3.12
Just a PSA that pylibint isn't working nicely with python 3.12. I see it locally on Linux, and GHA hits it on Mac.
There's some setup.py test complaints, but even running unittest directly, the third test segfaults. I haven't had problems with py312 and other pybind11 projects, so I'm not sure what's the trouble.
Anyways, this doesn't hinder me, but I'm posting in case others hit it. (If it's needed for CI before #271 is merged, change python3 -> [email protected] for homebrew.)
setuptools v41.5.0 deprecated the test command https://setuptools.pypa.io/en/latest/history.html#v41-5-0.
I tried to build libint exported from ca32e0c32071accb6074cdd023b4721d06a454f7, with python 3.11 and pybind11 v2.6.0 as downloaded by libint, but failed:
In file included from exported/build/_deps/pybind11-src/include/pybind11/attr.h:13,
from exported/build/_deps/pybind11-src/include/pybind11/pybind11.h:45,
from exported/python/src/libint2/libint2.cc:13:
build/_deps/pybind11-src/include/pybind11/cast.h: In function ‘std::string pybind11::detail::error_string()’:
build/_deps/pybind11-src/include/pybind11/cast.h:446:36: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
446 | " " + handle(frame->f_code->co_filename).cast<std::string>() +
| ^~
See https://docs.python.org/3.11/whatsnew/3.11.html#pyframeobject-3-11-hiding and pybind/pybind11#4464. pybind11 v2.10.0 or later is required.
With pybind11 v2.10.0, python3 setup.py test fails but it seems unrelated with libint.
Thanks for investigating. fwiw, I was using pybind11 v2.11.1 .
So CI is failing again (see #262, #275, #276) on Mac once these were rebased to include the homebrew [email protected] workaround to py312 failure.
My theory is that the GHA macOS image has, for a long time, had an old Python. https://github.com/actions/runner-images#available-images shows macos-latest bringing py27 (not a typo: 2.7). In this case, the homebrew upgrades python. And because homebrew "features" a weird-to-me takeover of system Python, pylibint2 finds the new py311, and all's well.
In my experience, even requesting macos-latest sometimes brings a variety of images (system python not always ==py27) as GHA rolls out runner images. So what the L2 CI is now seeing is the new macos-13 that comes with py312. Then homebrew declines to downgrade python to 311, and pylibint2 picks up py312 and fails.
Idk which of the three following strategies should be pursued:
- ~fix the GHA to
macos-12to try to prevent py312 from popping up~ ruled out by #280 - ~persuade homebrew to use py311 like we ask against its better judgement~ ruled out by #280
- find out why pylibint2 can't cope with py312
- ADDED get py another way on Mac+GHA like setup-python or conda
- ADDED give up testing pylibint2 on mac in Build/Repo section, and instead rely upon the Build/Export section that tests it as part of a full L2 build and as an independent cmake project. This is the current state of #280
There's some
setup.py testcomplaints, but even running unittest directly, the third test segfaults. I haven't had problems with py312 and other pybind11 projects, so I'm not sure what's the trouble.
I think support for 3.12 may not be complete even in pybind11 master. In Libint2's python "unit" test I seemed to have run into this problem when trying 3.12 with master pybind11: