[BUG]: Unknown CMake command "python3_add_library" with Python 3.14t (Free Threaded)
Required prerequisites
- [x] Make sure you've read the documentation. Your issue may be addressed there.
- [x] Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- [x] Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
stable (3.0.0)
Problem description
Hi!
I'm trying to use pybind11 with Python 3.14t (Free Threaded), using the official manylinux Docker images, but I'm running into the following issue:
Unknown CMake command "python3_add_library"
It works fine with all other Python versions, including the standard Python 3.14, but not with the free-threaded edition.
In my CMakeLists.txt I'm finding Python like this:
find_package(Python3 REQUIRED COMPONENTS Interpreter)
And I'm passing the Python executable from my setup.py, as seen here:
https://github.com/pytgcalls/ntgcalls/blob/master/setup.py#L79
Any idea why this issue happens specifically with Python 3.14t?
Thanks!
Is this a regression? Put the last known working version here if it is.
Not a regression
That's the wrong variable. If you are using FindPython3, you need to pass Python3_EXECUTABLE. Also, you have to include the Development.Module component, not just the Interpreter component. Though if possible, I'd recommend using our support for FindPython; if you use that, you can set set(PYBIND11_FINDPYTHON ON) to ensure you only have modern (Python_*) variables instead of PYTHON_* variables present.
That's the wrong variable. If you are using
FindPython3, you need to passPython3_EXECUTABLE. Also, you have to include theDevelopment.Modulecomponent, not just theInterpretercomponent. Though if possible, I'd recommend using our support for FindPython; if you use that, you can setset(PYBIND11_FINDPYTHON ON)to ensure you only have modern (Python_*) variables instead ofPYTHON_*variables present.
Oh well, but if I try to set up Development.Module it starts saying that libraries not exists even for python3.9+ (That currently they works)