Method 4: Tar File Installation#

Recommended for: Multiple TensorRT versions, custom installation paths, C++ and Python development on Linux

Advantages:

✓ High flexibility in installation location
✓ No root privileges needed for installation
✓ Multiple versions can coexist
✓ Includes C++ headers
✓ Complete control over environment

Limitations:

✗ Requires manual dependency management
✗ Manual LD_LIBRARY_PATH configuration
✗ No automatic updates
✗ More complex setup than other methods

Platform Support#

Supported Operating Systems:

  • Linux x86-64: Ubuntu 22.04+, RHEL 8+, Rocky Linux 8+, Debian 12+, SLES 15+

  • Linux ARM SBSA: Ubuntu 24.04+, Debian 12+

Prerequisites:

  • CUDA Toolkit installed (tar file or package manager)

Installation Steps#

Step 1: Download the TensorRT tar file

From the TensorRT download page, download the tar file that matches the CPU architecture and CUDA version you are using.

Example filename: TensorRT-Enterprise-11.3.0.x-Linux-x86_64-cuda-13.4-Release-external.tar.zst

Step 2: Choose installation directory

Choose where you want to install TensorRT. The tar file will install everything into a subdirectory called TensorRT-11.x.x.x, where 11.x.x.x is your TensorRT version.

Step 3: Extract the tar file

version="11.x.x.x"
arch=$(uname -m)
cuda="cuda-x.x"
tar -xvf TensorRT-Enterprise-${version}-Linux-${arch}-${cuda}-Release-external.tar.zst

Where 11.x.x.x is your TensorRT version and cuda-x.x is CUDA version. If extraction fails because the archive is zstd-compressed, use tar -I zstd -xvf or decompress with zstd -d first.

Step 4: Set environment variables

Add the TensorRT lib directory to LD_LIBRARY_PATH and the bin directory to PATH (required for trtexec):

export TENSORRT_DIR="$PWD/TensorRT-${version}"
export LD_LIBRARY_PATH=$TENSORRT_DIR/lib:$LD_LIBRARY_PATH
export PATH=$TENSORRT_DIR/bin:$PATH

For permanent configuration, add these lines to ~/.bashrc or ~/.profile:

echo "export TENSORRT_DIR=\"$PWD/TensorRT-${version}\"" >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$TENSORRT_DIR/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
echo 'export PATH=$TENSORRT_DIR/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Step 5 (Optional): Install Python wheels

Replace cp3x with the desired Python version (such as cp310 for Python 3.10):

cd TensorRT-${version}/python
python3 -m pip install tensorrt-*-cp3x-none-linux_x86_64.whl
cd TensorRT-${version}/python
python3 -m pip install tensorrt_lean-*-cp3x-none-linux_x86_64.whl
cd TensorRT-${version}/python
python3 -m pip install tensorrt_dispatch-*-cp3x-none-linux_x86_64.whl

Verification#

For quick checks that apply to every install method, refer to Verifying Your Installation in the installation overview. The steps below are specific to tar archives.

Ensure that the installed files are located in the correct directories.

C++ Verification:

Compile and run a sample, such as sampleOnnxMNIST. Samples and sample data are only available from GitHub. The instructions to prepare the sample data can be found within the samples README.md. To build all the samples, use the following commands:

$ cd <cloned_tensorrt_dir>
$ mkdir build && cd build
$ cmake .. \
   -DTRT_LIB_DIR=$TRT_LIBPATH \
   -DTRT_OUT_DIR=`pwd`/out \
   -DBUILD_SAMPLES=ON \
   -DBUILD_PARSERS=OFF \
   -DBUILD_PLUGINS=OFF
$ cmake --build . --parallel 4
$ ./out/sample_onnx_mnist

For information about the samples, refer to TensorRT Sample Support Guide.

Python Verification:

import tensorrt as trt
print(trt.__version__)
assert trt.Builder(trt.Logger())

Troubleshooting#

For install-wide diagnostics (CUDA, drivers, samples, and runtime failures), refer to Troubleshooting. Method-specific issues for tar archives:

Issue: error while loading shared libraries: libnvinfer.so.11

  • Solution: Ensure LD_LIBRARY_PATH is set correctly. Check:

    echo $LD_LIBRARY_PATH
    

    It should include $TENSORRT_INSTALL_DIR/lib.

Issue: Samples fail to compile

  • Solution: Install build essentials and CUDA development headers:

    sudo apt-get install build-essential cmake
    

Issue: Wrong Python wheel version

  • Solution: Check your Python version:

    python3 --version
    

    Download the matching wheel (cp310 for Python 3.10, cp311 for Python 3.11, cp312 for Python 3.12, cp313 for Python 3.13, cp314 for Python 3.14, and so on). Refer to the Support Matrix for the full list of supported Python versions in TensorRT 11.3.0.