Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy
 

How to install torch-tensorrt via python pip




torch-tensorrt - Torch-TensorRT is a package which allows users to automatically compile PyTorch and TorchScript modules to TensorRT while remaining in PyTorch, it belongs to Classifiers:

- Environment :: GPU
- Environment :: GPU :: NVIDIA CUDA
- Operating System :: POSIX :: Linux
- Programming Language :: C
- Programming Language :: C++
- Programming Language :: Python :: Implementation :: CPython
- Topic :: Scientific/Engineering :: Artificial Intelligence

When you know about this project and you want to new install torch-tensorrt to support your project or you get trouble as ModuleNotFoundError: No module named "torch-tensorrt" or ImportError: cannot import name "torch-tensorrt" in your project, let follow this tutorial to install torch-tensorrt



Installation:

Step 1: First, ensure you installed pip in your os, to check pip has been installed on your computer

In Windows (CMD):

py -m pip --version

In Unix/macOS:

python3 -m pip --version

Ensure pip, setuptools, and wheel are up to date:

In Windows (CMD):

py -m pip install --upgrade pip setuptools wheel

In Unix/macOS:

python3 -m pip install --upgrade pip setuptools wheel


Optional - If you want to install in virtual environment:

In Windows (CMD):

- Install virtualenv - if you installed it, please ignore

py -m pip install --user virtualenv

- Create a virtual environment

py -m venv test_torch-tensorrt_env

- Active the virtual environment

test_torch-tensorrt_env\Scripts\active

In Unix/macOS:

- Install virtualenv - if you installed it, please ignore

pip3 install virtualenv

- Create a virtual environment

python3 -m venv test_torch-tensorrt_env

- Active the virtual environment

source test_torch-tensorrt_env/bin/active


Step 2: OK, now, let flow below content to start the installation torch-tensorrt

To install torch-tensorrt on Windows(CMD):

py -m pip install torch-tensorrt

To install torch-tensorrt on Unix/macOs:

pip install torch-tensorrt


Step 3: If you want to install a specific torch-tensorrt version, add ==<torch-tensorrt version> to the end command line

Example:

pip install torch-tensorrt==0.0.0                                                                          yanked


Please see the version list below table:

VersionReleased dateCommand
torch-tensorrt 0.0.0.post12022-02-23T23:28:26Windows:

py -m pip install torch-tensorrt==0.0.0.post1

Unix/macOs:

pip install torch-tensorrt==0.0.0.post1

torch-tensorrt 0.0.0 yanked2021-08-05T00:06:17Windows:

py -m pip install torch-tensorrt==0.0.0                                                                          yanked

Unix/macOs:

pip install torch-tensorrt==0.0.0                                                                          yanked


Step 4: Otherwise, you can install torch-tensorrt from local archives:

Download the distribution file from torch-tensorrt-0.0.0.post1.tar.gz or the specific torch-tensorrt version in the below list of distribution

After that, install by command:

On Windows(CMD):

py -m pip install <path_to_torch-tensorrt_downloaded_file>

On Unix/macOs:

pip install <path_to_torch-tensorrt_downloaded_file>


List distribution:


Project link:

- Homepage
- Download