Skip to content

Build Python bindings for Python 3.15 - #4891

Open
KRRT7 wants to merge 1 commit into
NVIDIA:mainfrom
KRRT7:python-3.15-bindings
Open

KRRT7 wants to merge 1 commit into
NVIDIA:mainfrom
KRRT7:python-3.15-bindings

Conversation

@KRRT7

@KRRT7 KRRT7 commented Oct 24, 2026

Copy link
Copy Markdown

CPython 3.15.0 is out. This adds 3.15 to BUILD_PYTHON_PY_VERSIONS in python/CMakeLists.txt and raises the README prerequisite to <= v3.15.x. Tracking issue: #4890.

Evidence the bindings work on 3.15

Against the 11.3.0.99 GA libraries (Linux x86_64, CUDA 13.4, nvidia/cuda:13.4.1-devel-ubuntu24.04), the v11.3 bindings build for CPython 3.15.0 with no source changes and the repo's pinned pybind11 v3.0.1:

cmake <TRT_OSS> -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$TRT_ROOT \
  -DBUILD_PYTHON=ON -DBUILD_PLUGINS=OFF -DBUILD_PARSERS=OFF -DBUILD_SAMPLES=OFF \
  -DPython3_EXECUTABLE=<python3.15> -DTRT_BUILD_PYTHON_PY_VERSIONS=3.15 \
  -DTRT_BUILD_PYTHON_EXTERNALS_PATH=<prefix>/include
ninja tensorrt_bindings_tensorrt_3.15

The resulting tensorrt.so, in the official cp314 wheel layout retagged cp315, behaves the same as the official cp314 wheel (on 3.14) in the same container: it imports, reports 34 plugin creators, tensorrt.plugin imports, and pybind11 calls from a non-main thread work. Engine building and inference were not run (no GPU in that environment).

A note on CPython 3.15 ABI that matters for any binding built against 3.15 pre-releases: 3.15.0b4 added a PyThreadState field (last_profiled_frame_seq), which moved gilstate_counter, and pybind11's gil_scoped_acquire touches that field directly. Bindings must be built against 3.15.0b4 or later headers. PyTorch's macOS cp315 2.14.1 wheel was built against earlier headers and segfaults (pytorch/pytorch#201944).

Not changed, but worth a look

CPython 3.15.0 is out. Add 3.15 to the default binding versions and the
README prerequisites. The 11.3 bindings build for 3.15 with no source
changes (see NVIDIA#4890).

Signed-off-by: Kevin Turcios <turcioskevinr@gmail.com>
@KRRT7
KRRT7 requested a review from a team as a code owner October 24, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants