Install & Compatibility
Where this runs
tested against v11.0.0.114 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 24MB
22MB installed
● package 22MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
tensorrt_bindings
✓ import tensorrt_bindings as trt
✗ import tensorrt as trt
This quickstart demonstrates how to initialize the TensorRT builder, define a simple identity network with an explicit batch dimension, configure the builder, and build a TensorRT engine. This is the fundamental process for optimizing and compiling deep learning models for NVIDIA GPUs.
import tensorrt as trt
import numpy as np
# 1. Create a logger (TRT_LOGGER = trt.Logger(trt.Logger.INFO) for more verbose output)
TRT_LOGGER = trt.Logger(trt.Logger.WARNING)
# 2. Create builder, network, and configuration
builder = trt.Builder(TRT_LOGGER)
# Explicit batch is required for some features (e.g., dynamic shapes)
network = builder.create_network(1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH))
config = builder.create_builder_config()
# Configure builder options
# max_workspace_size: The maximum GPU memory size (in bytes) that TensorRT can use for temporary buffers.
config.max_workspace_size = 1 << 20 # 1 MiB (adjust as needed for larger models)
# 3. Define the network: a simple identity layer for demonstration
# Input shape (batch_size, channels, height, width)
input_shape = (1, 3, 224, 224)
input_tensor = network.add_input(name="input_tensor", dtype=trt.float32, shape=input_shape)
# Add an identity layer as a simple example operation
identity_layer = network.add_identity(input_tensor)
output_tensor = identity_layer.get_output(0)
# Mark the output tensor
network.mark_output(output_tensor)
output_tensor.name = "output_tensor"
# 4. Build the engine
print(f"Building TensorRT engine with input shape {input_shape}...")
engine = builder.build_engine(network, config)
if engine:
print("TensorRT engine built successfully!")
# Example: serialize the engine to disk
# with open("my_identity_engine.trt", "wb") as f:
# f.write(engine.serialize())
# print("Engine serialized to my_identity_engine.trt")
else:
print("Failed to build TensorRT engine.")
# Cleanup
del network, builder, config, engine
Debug
Known issues
breakingThe `tensorrt-cuXX-bindings` packages are tightly coupled with specific CUDA versions (e.g., `cu12` for CUDA 12.x). Using a mismatched CUDA driver or toolkit version on your system will lead to runtime failures or import errors.fixVerify your NVIDIA CUDA Toolkit and driver versions precisely match the `cuXX` suffix of the installed package. Upgrade or downgrade system CUDA components as necessary.
affects: All `tensorrt-cuXX-bindings` packages.
breakingTensorRT 10.13.2 dropped official support for CUDA 11.X. Additionally, official samples and demos now require Python 3.10 or newer.fixFor full compatibility and access to samples/demos, ensure you are running a CUDA 12.x (or newer) environment and Python 3.10 or newer.
affects: TensorRT 10.13.2 and later.
breakingCustom TensorRT plugins (e.g., those implementing `IPluginV2`) are being migrated to `IPluginV3`. Older plugin versions may be deprecated and removed in future releases.fixIf you maintain custom plugins, review the TensorRT documentation for plugin migration guides and update them to `IPluginV3` or later to ensure forward compatibility.
affects: TensorRT 10.11 and later.
deprecatedOfficial TensorRT Python samples and tools have transitioned from `pycuda` to `cuda-python` for low-level CUDA interactions.fixUpdate any custom Python code that directly uses `pycuda` for CUDA context management or memory operations to use `cuda-python` for alignment with official practices and future compatibility.
affects: TensorRT 10.14 and later.
gotchaStarting with TensorRT 10.14, samples and demos are no longer included directly within the `tensorrt-cuXX-bindings` Python packages.fixAccess all TensorRT samples, demos, and associated scripts directly from the official NVIDIA TensorRT GitHub repository (github.com/nvidia/tensorrt/tree/main/samples).
affects: TensorRT 10.14 and later.
Upgrade
Version history
11.0.0.114latest on PyPI · released May 27, 2026
Audit
Dependencies
cuda-pythonrequiredUsed for low-level CUDA API interactions in newer versions.
numpyrequiredStandard for numerical operations and array handling.
NVIDIA CUDA Toolkit (system-level)requiredRequires a compatible NVIDIA CUDA Toolkit (12.x) and driver installed on the system.