Method 1: Python Package Index (pip)#
Recommended for: Python developers, quick prototyping, virtual environments
Advantages:
Limitations:
trtexec CLI. Use Debian/RPM, tar/zip, or container for Build Your First EnginePlatform Support#
Supported Configurations:
Python versions: 3.11, 3.12, 3.13, 3.14
Operating Systems:
Linux x86-64: Ubuntu 22.04+, RHEL 8+, Debian 12+, SLES 15+
Linux ARM SBSA and NVIDIA JetPack: Ubuntu 24.04+, Debian 12+
Windows x64: Windows 10+, Windows Server 2022+
Windows Arm64: Windows 11
Note
On Jetson AGX Orin and Jetson AGX Thor, install TensorRT from the SBSA build rather than assuming a JetPack-bundled wheel. Refer to Migrating TensorRT from 10.x to 11.x on Jetson/JetPack.
Note
Python 3.11 or later is required for TensorRT samples. Python 3.8, 3.9, and 3.10 bindings are deprecated and will be removed in a future release. Refer to TensorRT Release Notes.
Installation Steps#
Step 1: Create and activate a virtual environment
# Debian and Ubuntu ship venv separately from the base Python.
sudo apt-get install -y python3-venv
python3 -m venv trt-env
source trt-env/bin/activate
Activate this environment in every shell where you install or run TensorRT, and run the remaining steps with it active.
Note
A virtual environment is required on Debian 12, Ubuntu 23.04, and later
releases. These mark the system Python as externally managed
(PEP 668), so pip refuses to
install into it and reports error: externally-managed-environment.
Step 2: Update pip and install wheel
python3 -m pip install --upgrade pip
python3 -m pip install wheel
Step 3: Install TensorRT
Install the complete TensorRT package with builder and runtime:
python3 -m pip install --upgrade tensorrt
This installs:
tensorrt-cu13-libs: TensorRT core libraries (tensorrt-cu12-libsfor the CUDA 12 variant)tensorrt-cu13-bindings: Python bindings matching your Python version (tensorrt-cu12-bindingsfor the CUDA 12 variant)
The dependency names carry the CUDA major version because the bare tensorrt package installs the CUDA 13.x variant by default. Use these names when you pin or remove dependencies, as in Uninstalling TensorRT.
Install only the lean runtime for running pre-built engines:
python3 -m pip install --upgrade tensorrt-lean
Install the minimal dispatch runtime:
python3 -m pip install --upgrade tensorrt-dispatch
CUDA Version Selection:
By default, TensorRT Python packages install the CUDA 13.x variants (the latest CUDA version supported by TensorRT). If you need a specific CUDA major version, append -cu12 or -cu13 to the package name:
# For CUDA 12.x
python3 -m pip install --upgrade tensorrt-cu12
# For CUDA 13.x (default, explicit)
python3 -m pip install --upgrade tensorrt-cu13
# Lean and Dispatch runtimes with CUDA 12.x
python3 -m pip install --upgrade tensorrt-lean-cu12 tensorrt-dispatch-cu12
# Lean and Dispatch runtimes with CUDA 13.x
python3 -m pip install --upgrade tensorrt-lean-cu13 tensorrt-dispatch-cu13
Tip
For upgrading an existing installation, clear the pip cache first:
python3 -m pip cache remove "tensorrt*"
python3 -m pip install --upgrade tensorrt tensorrt-lean tensorrt-dispatch
Verification#
Pip wheels do not include trtexec. Verify with Python only (do not run
trtexec --help unless you also installed a non-pip TensorRT package).
For the shared non-pip checks, refer to Verifying Your Installation in the installation overview. The steps below are specific to pip wheels.
Verify Full Runtime (if installed):
To confirm your installation is working:
Import the
tensorrtmoduleCheck the installed version
Create a
Builderobject to verify CUDA installation
import tensorrt as trt
print(trt.__version__)
assert trt.Builder(trt.Logger())
Expected output:
11.5.0
Verify Lean Runtime (if installed):
import tensorrt_lean as trt
print(trt.__version__)
assert trt.Runtime(trt.Logger())
Verify Dispatch Runtime (if installed):
import tensorrt_dispatch as trt
print(trt.__version__)
assert trt.Runtime(trt.Logger())
Next Steps:
For the ~10-minute CLI basic verification test (
trtexec), install Debian/RPM, tar/zip, or container, then follow Build Your First Engine.To stay on pip, continue with the TensorRT Sample Support Guide Python samples and the Python API documentation, which build the engine through the Python API. The tutorials in the Quick Start Guide build their engines with
trtexec, which a pip-only install does not provide.
If the verification commands above worked successfully, you can now run TensorRT Python samples to further confirm your installation. For more information about TensorRT samples, refer to the TensorRT Sample Support Guide.
Troubleshooting#
For install-wide diagnostics (CUDA, drivers, samples, and runtime failures), refer to Troubleshooting. Method-specific issues for pip installs:
Issue: ModuleNotFoundError: No module named 'tensorrt'
Solution: Ensure you are in the correct Python environment. Activate the virtual environment you created in Step 1.
Issue: Need C++ headers or samples
Solution:
pipinstallation does not include C++ headers. Use Debian Packages, RPM Packages, Tar File, or Zip File installation instead.
Issue: User-specific installation (no root)
Solution: The virtual environment in Step 1 already installs without root and is the recommended approach.
python3 -m pip install --user tensorrtis an alternative, but only on releases whose system Python is not externally managed. On Debian 12, Ubuntu 23.04, and later,--useris refused along with system-wide installs.
Issue: Encounter a TypeError while executing pip install
Solution: Update the
setuptoolsandpackagingPython modules:python3 -m pip install --upgrade setuptools packaging
Issue: CUDA initialization failure during verification
If the verification command fails with an error similar to:
[TensorRT] ERROR: CUDA initialization failure with error 100. Please check your CUDA installation: ...
Solution: This indicates the NVIDIA driver is not installed or not functioning properly. Check the following:
Verify the NVIDIA driver is installed:
nvidia-smi
If running inside a container, ensure you are using a GPU-enabled CUDA base image that matches your CUDA toolkit (for TensorRT 11.5.0 Debian, RPM, tar, and zip packages that is CUDA Toolkit 13.5).
Reinstall or update the NVIDIA driver if necessary. Refer to the NVIDIA Driver Downloads page.