NVIDIA / TensorRT

NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT.
https://developer.nvidia.com/tensorrt
Apache License 2.0
10.15k stars 2.08k forks source link

Installing tensorrt 10.0.1 pypi package installs wrong version of tensorrt-cu12 #3945

Open pharmapsychotic opened 2 weeks ago

pharmapsychotic commented 2 weeks ago

Description

pip install --extra-index-url https://pypi.nvidia.com tensorrt==10.0.1 now installs tensorrt 10.1 instead of 10.0.1 and fails to deserialize engines built with 10.0.1

Steps To Reproduce

$pip install --extra-index-url https://pypi.nvidia.com tensorrt==10.0.1
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com, https://pypi.nvidia.com
Collecting tensorrt==10.0.1
  Downloading https://pypi.nvidia.com/tensorrt/tensorrt-10.0.1.tar.gz (16 kB)
  Preparing metadata (setup.py) ... done
Collecting tensorrt-cu12
  Downloading https://pypi.nvidia.com/tensorrt-cu12/tensorrt-cu12-10.1.0.tar.gz (18 kB)
  Preparing metadata (setup.py) ... done
Collecting tensorrt-cu12_libs==10.1.0
  Downloading https://pypi.nvidia.com/tensorrt-cu12-libs/tensorrt_cu12_libs-10.1.0-py2.py3-none-manylinux_2_17_x86_64.whl (1056.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 GB 11.7 MB/s eta 0:00:00
Collecting tensorrt-cu12_bindings==10.1.0
  Downloading https://pypi.nvidia.com/tensorrt-cu12-bindings/tensorrt_cu12_bindings-10.1.0-cp310-none-manylinux_2_17_x86_64.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 11.8 MB/s eta 0:00:00
Collecting nvidia-cuda-runtime-cu12
  Downloading https://pypi.nvidia.com/nvidia-cuda-runtime-cu12/nvidia_cuda_runtime_cu12-12.5.39-py3-none-manylinux2014_x86_64.whl (895 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 895.1/895.1 kB 11.9 MB/s eta 0:00:00
Installing collected packages: tensorrt-cu12_bindings, nvidia-cuda-runtime-cu12, tensorrt-cu12_libs, tensorrt-cu12, tensorrt
  DEPRECATION: tensorrt-cu12 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for tensorrt-cu12 ... done
  DEPRECATION: tensorrt is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for tensorrt ... done
Successfully installed nvidia-cuda-runtime-cu12-12.5.39 tensorrt-10.0.1 tensorrt-cu12-10.1.0 tensorrt-cu12_bindings-10.1.0 tensorrt-cu12_libs-10.1.0

It looks like the metapackage tensorrt has tensorrt-cu12 dependency which is not pinned to a specific version so older version of tensorrt is installing latest version of tensorrt-cu12.

pharmapsychotic commented 2 weeks ago

Looks like can workaround with pip install --extra-index-url https://pypi.nvidia.com tensorrt==10.0.1 tensorrt-cu12==10.0.1

Essa79 commented 2 weeks ago

You're absolutely right, pip is installing TensorRT 10.1 instead of the desired 10.0.1 when using the extra index URL with --extra-index-url https://pypi.nvidia.com. Here's how to address this issue:

Understanding the Problem:

The NVIDIA PyPI repository seems to prioritize newer versions on the index. Even though you specify ==10.0.1, it might not install that specific version because 10.1 is available. Solutions:

Downgrade After Installation:

Install TensorRT 10.1 first: Bash pip install --extra-index-url https://pypi.nvidia.com tensorrt Then downgrade to 10.0.1 using the --force-reinstall option: Bash pip install --extra-index-url https://pypi.nvidia.com tensorrt==10 This approach might not be ideal as it installs the newer version first, but it achieves the end goal.

Use a Virtual Environment:

Create a virtual environment to isolate TensorRT 10.0.1 and prevent conflicts with other projects. Activate the environment and then install TensorRT 10.0.1 using the specified method. This ensures the specific version is installed within the virtual environment. Build from Source (Advanced):

If strict version control is crucial, consider building TensorRT 10.0.1 from source. Download the source code from the NVIDIA NGC catalog and follow the build instructions. Recommendation:

For most scenarios, using a virtual environment (solution 2) is the preferred approach. It provides a clean and isolated environment for specific project dependencies.

Additional Considerations:

Make sure your CUDA Toolkit and NVIDIA Driver versions are compatible with TensorRT 10.0.1. You can find compatibility information in the TensorRT documentation. If you continue to face issues, search online for solutions related to specific error messages encountered during installation. By following these strategies, you should be able to successfully install the desired version of TensorRT (10.0.1) for your project.

akhilg-nv commented 2 weeks ago

We have filed this bug internally and plan to fix it for the next release. In the meantime, please use pip install --extra-index-url https://pypi.nvidia.com tensorrt-cu12==10.0.1 to install TRT 10.0.1.