TensorRT: [python] pip install fails starting with tensorrt 8.6.1 release

Description

Hi 👋

pip install is broken for latest tensorrt:

  • tensorrt 8.6.0 posted only wheels to PyPI
  • tensorrt 8.6.1 posts only a source distribution to PyPI
  • the install of tensorrt 8.6.1 tries to fetch tensorrt_libs==8.6.1 from https://pypi.nvidia.com
  • from the traceback below, the latter index seems to be private / not publicly accessible

Environment

irrelevant

Relevant Files

irrelevant

Steps To Reproduce

Simply run a pip install in any venv:

Commands or scripts:

$ pip install tensorrt
Collecting tensorrt
  Downloading tensorrt-8.6.1.tar.gz (16 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
  ╰─> [49 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'
      /Users/ddelange/.pyenv/versions/3.8.10/envs/vv/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      installing to build/bdist.macosx-10.15-x86_64/wheel
      running install
      Looking in indexes: https://pypi.nvidia.com
      ERROR: Could not find a version that satisfies the requirement tensorrt_libs==8.6.1 (from versions: none)
      ERROR: No matching distribution found for tensorrt_libs==8.6.1
      WARNING: There was an error checking the latest version of pip.
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/_b/ldf_nfdx3qndz_5lvxxkchsc0000gn/T/pip-install-8nnh031o/tensorrt_2ea76508e3b64219b3a1a1c3602f7e99/setup.py", line 49, in <module>
          setup(
        File "/Users/ddelange/.pyenv/versions/3.8.10/envs/vv/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/Users/ddelange/.pyenv/versions/3.8.10/envs/vv/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 335, in run
          self.run_command('install')
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/private/var/folders/_b/ldf_nfdx3qndz_5lvxxkchsc0000gn/T/pip-install-8nnh031o/tensorrt_2ea76508e3b64219b3a1a1c3602f7e99/setup.py", line 43, in run
          install_dep("{:}_libs".format(tensorrt_module))
        File "/private/var/folders/_b/ldf_nfdx3qndz_5lvxxkchsc0000gn/T/pip-install-8nnh031o/tensorrt_2ea76508e3b64219b3a1a1c3602f7e99/setup.py", line 41, in install_dep
          status.check_returncode()
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/subprocess.py", line 448, in check_returncode
          raise CalledProcessError(self.returncode, self.args, self.stdout,
      subprocess.CalledProcessError: Command '['/Users/ddelange/.pyenv/versions/3.8.10/envs/vv/bin/python3.8', '-m', 'pip', 'install', 'tensorrt_libs==8.6.1', '--index-url', 'https://pypi.nvidia.com']' 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
Installing collected packages: tensorrt
  Running setup.py install for tensorrt ... error
  error: subprocess-exited-with-error

  × Running setup.py install for tensorrt did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      running install
      /Users/ddelange/.pyenv/versions/3.8.10/envs/vv/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      Looking in indexes: https://pypi.nvidia.com
      ERROR: Could not find a version that satisfies the requirement tensorrt_libs==8.6.1 (from versions: none)
      ERROR: No matching distribution found for tensorrt_libs==8.6.1
      WARNING: There was an error checking the latest version of pip.
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/_b/ldf_nfdx3qndz_5lvxxkchsc0000gn/T/pip-install-8nnh031o/tensorrt_2ea76508e3b64219b3a1a1c3602f7e99/setup.py", line 49, in <module>
          setup(
        File "/Users/ddelange/.pyenv/versions/3.8.10/envs/vv/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/private/var/folders/_b/ldf_nfdx3qndz_5lvxxkchsc0000gn/T/pip-install-8nnh031o/tensorrt_2ea76508e3b64219b3a1a1c3602f7e99/setup.py", line 43, in run
          install_dep("{:}_libs".format(tensorrt_module))
        File "/private/var/folders/_b/ldf_nfdx3qndz_5lvxxkchsc0000gn/T/pip-install-8nnh031o/tensorrt_2ea76508e3b64219b3a1a1c3602f7e99/setup.py", line 41, in install_dep
          status.check_returncode()
        File "/Users/ddelange/.pyenv/versions/3.8.10/lib/python3.8/subprocess.py", line 448, in check_returncode
          raise CalledProcessError(self.returncode, self.args, self.stdout,
      subprocess.CalledProcessError: Command '['/Users/ddelange/.pyenv/versions/3.8.10/envs/vv/bin/python3.8', '-m', 'pip', 'install', 'tensorrt_libs==8.6.1', '--index-url', 'https://pypi.nvidia.com']' 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: legacy-install-failure

× Encountered error while trying to install package.
╰─> tensorrt

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

[notice] A new release of pip available: 22.3.1 -> 23.1.2
[notice] To update, run: python3.8 -m pip install --upgrade pip

Have you tried the latest release?: 8.6.1 at time of writing

Can this model run on other frameworks? For example run ONNX model with ONNXRuntime (polygraphy run <model.onnx> --onnxrt): N/A

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 13
  • Comments: 32 (19 by maintainers)

Most upvoted comments

same problem… problem solved! the key is downgrading pip

pip install pip==21.3.1

I had to upgrade pip to be able to install the tensorrt package: pip3 install --upgrade pip

@couzhei, could you maybe try adding -v to the pip install command and see if more gets printed?

I have the same problem here, my pip install tensorrt doesn’t even begin to start, it just get frozen at beginning building wheels:

Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting tensorrt==8.6.1
  Downloading tensorrt-8.6.1.tar.gz (16 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: tensorrt
  Building wheel for tensorrt (setup.py) ... /

@joeyballentine I guess the thread in https://github.com/NVIDIA/TensorRT/pull/3080 is a pretty good summary

@joeyballentine, we do actually have some Windows wheels published, but they are currently pre-release. You can see one example component of the full package at https://pypi.nvidia.com/tensorrt-libs/. The next general release (supporting both LLM and non-LLM networks and the full scope of GPUs) will include Windows wheels not under a pre-release (--pre) flag.

The reason we don’t release the wheel files in the zip file is because they don’t contain the libraries inside, which means they are not standalone. The release linked above is a full release (with libs), but TRT 9.x is specifically for LLM support and tested on mostly data center GPUs. In summary things will improve and become more seamless, but you’ll need to wait for the next major TRT release.

@ddelange, the fake packages recently published for the TRT 9.0 pre-release wheels now have --no-cache-dir in the help description.

I was initially having the same error message as @ddelange, and then I updated both pip and setuptools. However, now when running the command pip install tensorrt, I get the error after 65 lines of output that there is No Module named pip. Could anyone help me figure out how to troubleshoot this?

@couzhei In my case it was silently downloading ~2GB in wheel files, so it wasn’t really frozen. Give @zeroepoch 's suggestion a go, you might discover the same!

The answer only works if the issue is that you are installing a linux wheel on mac os. I am getting same error using nvidia/cuda:11.3.0-base-ubuntu20.04

I even made sure to try and install the python3 wheel for linux directly: https://pypi.nvidia.com/tensorrt-libs/tensorrt_libs-8.6.1-py2.py3-none-manylinux_2_17_x86_64.whl

@HarryCaveMan can you provide the commands you tried and the errors that were printed? We had some internal users report a similar issue when 8.6.1 was first posted, but I think it got resolved on the server side maybe since I haven’t heard any more issues since then.

One user with an old Ubuntu version had to first update setuptools before the internal pip install worked. Can you try python3 -m pip install --upgrade setuptools and see if that helps?

The answer only works if the issue is that you are installing a linux wheel on mac os. I am getting same error using nvidia/cuda:11.3.0-base-ubuntu20.04

I even made sure to try and install the python3 wheel for linux directly: https://pypi.nvidia.com/tensorrt-libs/tensorrt_libs-8.6.1-py2.py3-none-manylinux_2_17_x86_64.whl