Registry / ai-ml / tensorrt-cu12

tensorrt-cu12

JSON →
library11.0.0.114pypypiunverified

TensorRT is a high-performance deep learning inference optimizer and runtime from NVIDIA. The `tensorrt-cu12` package provides the Python bindings specifically compiled for CUDA Toolkit 12.x. As of its latest version `10.16.1.11`, it supports optimizing and deploying trained deep learning models for faster inference on NVIDIA GPUs. Releases are frequent, typically aligning with major TensorRT core library and CUDA toolkit updates.

pip install tensorrt-cu12
INSTALL
IMPORT
SIG · TENSORRT-CU12
T
tensorrt-cu12
ai-mlpythonv11.0.0.114
Install
82.5s avg
Import
611ms
Disk
6349MB
Pass rate
3/ 10
Env Coverage3 / 10
glibc
3.93.13
musl
3.93.13
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
musl
glibc
py 3.10
✕ build_error
✓ 86.6s
py 3.11
✕ build_error
3/4 runs
py 3.12
✕ build_error
3/4 runs
py 3.13
✕ build_error
✓ 73.38s
py 3.9
✕ build_error
✓ 87.65s
6349MB installed
● package 6349MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tensorrt
import tensorrt as trt
import trt
The standard convention is to import `tensorrt` and alias it as `trt` for brevity.
Logger
from tensorrt import Logger
from tensorrt.infer import Logger
Core classes like Logger, Builder, Network are directly under the `tensorrt` top-level package.

This quickstart demonstrates the foundational steps of initializing TensorRT components: a logger, a builder, and a network. It serves as a basic sanity check for TensorRT installation and API access. A complete workflow would involve parsing an existing model (e.g., ONNX, UFF), configuring optimization profiles, and building an inference engine.

import tensorrt as trt import os # A basic example: creating a TensorRT builder and network # Note: A real application would involve loading an ONNX/UFF model and building an engine. # Create a logger to track verbose output and errors TRT_LOGGER = trt.Logger(trt.Logger.WARNING) try: # Create a builder builder = trt.Builder(TRT_LOGGER) print(f"TensorRT Builder created successfully. Max batch size: {builder.max_batch_size}") # Create an empty network definition. EXPLICIT_BATCH is crucial for modern TensorRT. network = builder.create_network(1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)) print("Network created with EXPLICIT_BATCH flag.") # Example: Add an input layer (simplified, a real model would have specific shapes) input_tensor = network.add_input(name='input_tensor', dtype=trt.float32, shape=(1, 3, 224, 224)) print(f"Added input tensor with shape {input_tensor.shape}") # In a real scenario, you'd parse a model, e.g., using trt.OnnxParser(network, TRT_LOGGER) # and then configure the builder for engine creation and serialization. except Exception as e: print(f"An error occurred: {e}") print("Please ensure you have a compatible NVIDIA GPU and the correct CUDA/cuDNN installations.") # Clean up resources (important for complex applications) # Note: In a production script, `del` might not be strictly necessary if objects go out of scope, # but it's good practice for clarity or long-running processes. # Also, ensure network and builder are valid objects before attempting to delete. if 'network' in locals() and network is not None: del network if 'builder' in locals() and builder is not None: del builder if 'TRT_LOGGER' in locals() and TRT_LOGGER is not None: del TRT_LOGGER
Debug
Known issues
breakingTensorRT 10.13.2 (and subsequent versions) dropped support for Python versions older than 3.10 and CUDA 11.x. Users on older environments must upgrade their Python interpreter or use an older `tensorrt-cu12` package version.
fix
Upgrade Python to 3.10+ and ensure system CUDA is 12.x compatible. For CUDA 11.x, consider using `tensorrt-cu11` or an older `tensorrt` version.
affects: >=10.13.2
gotchaThe `tensorrt-cu12` package requires a matching system-wide NVIDIA CUDA Toolkit and cuDNN installation (version 12.x) to be present and correctly configured (e.g., via `LD_LIBRARY_PATH` on Linux). These are *not* installed by `pip`.
fix
Manually install NVIDIA CUDA Toolkit 12.x and cuDNN for CUDA 12.x from NVIDIA's developer website. Ensure `nvcc --version` shows CUDA 12.x and that the library paths are correctly set up for your OS.
affects: all
deprecatedTensorRT 10.14 deprecated `pycuda` usages in its samples and shifted towards `cuda-python`. While not a direct breaking change for the core API, it indicates a shift in recommended practices for low-level CUDA interaction.
fix
Review custom plugins or CUDA-interfacing code that uses `pycuda`. Consider migrating to `cuda-python` for future compatibility and to align with NVIDIA's recommended practices.
affects: >=10.14
breakingSeveral standard plugins (e.g., `cropAndResizeDynamic`, `DecodeBbox3DPlugin`) have been migrated from `IPluginV2` to `IPluginV3`, with `IPluginV2` versions being deprecated and scheduled for removal. Custom plugins implementing `IPluginV2` might need updates.
fix
Update custom TensorRT plugins to implement `IPluginV3` (or higher) to ensure future compatibility. Refer to the TensorRT developer guide for specific plugin API migration details.
affects: >=10.12
Upgrade
Version history
11.0.0.114latest on PyPI · released May 27, 2026
Audit
Dependencies
cuda-pythonoptionalOften used for low-level CUDA interactions, especially if converting `pycuda` code. Not a direct dependency but a common companion for advanced use cases.
Agent activity
50 hits · last 30 days
node
48
OpenAI (training)
1
Resources
tensorrt-cu12 — pip install tensorrt-cu12 · libregistry