Failed building wheel for tensorrt

Description

I am trying to install tensorrt on my Jetson AGX Orin. For that, I am following the Installation guide.

When trying to execute:
python3 -m pip install --upgrade tensorrt

I get the following output:

Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Requirement already satisfied: tensorrt in /usr/lib/python3.8/dist-packages (8.5.2.2)
Collecting tensorrt
  Downloading tensorrt-8.6.1.post1.tar.gz (18 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: tensorrt
  Building wheel for tensorrt (setup.py) ... error
  error: subprocess-exited-with-error
  
  Ă— python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib
      creating build/lib/tensorrt
      copying tensorrt/__init__.py -> build/lib/tensorrt
      running egg_info
      writing tensorrt.egg-info/PKG-INFO
      writing dependency_links to tensorrt.egg-info/dependency_links.txt
      writing requirements to tensorrt.egg-info/requires.txt
      writing top-level names to tensorrt.egg-info/top_level.txt
      reading manifest file 'tensorrt.egg-info/SOURCES.txt'
      adding license file 'LICENSE.txt'
      writing manifest file 'tensorrt.egg-info/SOURCES.txt'
      installing to build/bdist.linux-aarch64/wheel
      running install
      Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com, https://pypi.nvidia.com
      ERROR: Could not find a version that satisfies the requirement tensorrt_libs==8.6.1 (from versions: 9.0.0.post11.dev1, 9.0.0.post12.dev1, 9.0.1.post11.dev4, 9.0.1.post12.dev4, 9.1.0.post11.dev4, 9.1.0.post12.dev4)
      ERROR: No matching distribution found for tensorrt_libs==8.6.1
      Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com, https://pypi.nvidia.com
      ERROR: Could not find a version that satisfies the requirement tensorrt_libs==8.6.1 (from versions: 9.0.0.post11.dev1, 9.0.0.post12.dev1, 9.0.1.post11.dev4, 9.0.1.post12.dev4, 9.1.0.post11.dev4, 9.1.0.post12.dev4)
      ERROR: No matching distribution found for tensorrt_libs==8.6.1
      Traceback (most recent call last):
        File "/tmp/pip-install-b5g5dsev/tensorrt_99bbf7afbc544d02bc794b327cecbd48/setup.py", line 40, in run_pip_command
          return call_func([sys.executable, "-m", "pip"] + args, env=env)
        File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/home/orin/venv/bin/python3', '-m', 'pip', 'install', '--extra-index-url', 'https://pypi.nvidia.com', 'tensorrt_libs==8.6.1', 'tensorrt_bindings==8.6.1']' returned non-zero exit status 1.
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-b5g5dsev/tensorrt_99bbf7afbc544d02bc794b327cecbd48/setup.py", line 110, in <module>
          setup(
        File "/home/orin/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/orin/venv/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 399, in run
          self.run_command("install")
        File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-b5g5dsev/tensorrt_99bbf7afbc544d02bc794b327cecbd48/setup.py", line 62, in run
          run_pip_command(
        File "/tmp/pip-install-b5g5dsev/tensorrt_99bbf7afbc544d02bc794b327cecbd48/setup.py", line 56, in run_pip_command
          return call_func([pip_path] + args, env=env)
        File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/home/orin/venv/bin/pip', 'install', '--extra-index-url', 'https://pypi.nvidia.com', 'tensorrt_libs==8.6.1', 'tensorrt_bindings==8.6.1']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tensorrt
  Running setup.py clean for tensorrt
Failed to build tensorrt
ERROR: Could not build wheels for tensorrt, which is required to install pyproject.toml-based projects

I have already tried to solve it following these instructions: Tensorrt not installing with pip. I created a virtual environment as indicated, but it doesn’t solve the issue.

Environment

TensorRT Version: 8.5.2
CUDA Version: 11.4
Operating System + Version: Jetson 5.1.2
Python Version (if applicable): 3.8

I’ve just checked and when I run:

python3
import tensorrt
print(tensorrt.version)

I get the following output: 8.5.2.2

I understand that this means tensorrt is already installed. However, when trying to install torch2trt I get the error:

root@ubuntu:/torch2trt# python setup.py install
Traceback (most recent call last):
File “setup.py”, line 2, in
import tensorrt
ImportError: No module named tensorrt

Seeing that I’m not getting any reply, I will say that I solved the issue by using a docker image with tensorrt pre-installed. I got it from here. Here I managed to install PyTorch and torch2trt.

Having the same problem. Please help. The HW is far too expensive to not get help

1 Like

In the installation guide, it says:

While the tar file installation supports multiple CUDA versions, the Python Package Index installation does not and only supports CUDA 12.x in this release.

Although this might not be the cause for your specific error, installing TensorRT via the Python wheel seems not to be an option regarding your CUDA version 11.4.

Have you tried installing TensorRT via the TAR File?

I had the same problem,
my Environment
TensorRT Version: 8.2.1
CUDA Version: 10.2
Operating System + Version: Jetson 4.6.2
Python Version (if applicable): 3.6
**system:ubuntu18.04
But couldn’t find a python wheel suitable for this environment,All are lunix versions, no ubuntu versions found,do you know where TAR File suitable for my version?