TensorRT 3 RC - unable to import 'uff' python module

Are there any other steps needed to install ‘uff’ python module? I installed TensorRT 3 RC python using “pip3 install tensorrt-3.0.0-cp35-cp35m-linux_x86_64.whl”. This part succeeded. But I got error when importing tensorrt

import tensorrt as trt
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.5/dist-packages/tensorrt/init.py”, line 28, in
from tensorrt import infer, parsers, utils, lite, plugins
File “/usr/local/lib/python3.5/dist-packages/tensorrt/lite/init.py”, line 5, in
from .engine import Engine
File “/usr/local/lib/python3.5/dist-packages/tensorrt/lite/engine.py”, line 2, in
import uff
ImportError: No module named ‘uff’

I found the whl file for ‘uff’.

The (uff-0.1.0rc0-py2.py3-none-any.whl) file was located in /TensorRT-3.0.0/uff, you have to install it by “pip install uff-0.1.0rc0-py2.py3-none-any.whl”

.

Hi there!
I had the same issue and I could install tensorrt following this guide: https://docs.nvidia.com/deeplearning/sdk/tensorrt-archived/tensorrt_304/tensorrt-install-guide/index.html#installing-debian.
Basically, you have to download and install the tensorrt deb package (e.g. nv-tensorrt-repo-ubuntu1604-ga-cuda9.0-trt3.x.x-yyyymmdd_1-1_amd64.deb) with dpkg, then you can install tensorrt simply running:

apt install tensorrt

To install the python modules and uff you should also execute:

apt install python-libnvinfer-doc uff-converter-tf
1 Like

Hi @jd_ruan,

I had the same error and i believe it’s because you might have not installed the uff module and hence it’s not able to locate it when you run the script.

Firstly, you have to download the right TensorRT version and extract it with the following command from the the directory where the TensorRT was downloaded;

tar -xzf TensorRT-3.0.4.Ubuntu-16.04.3.x86_64.cuda-9.0.cudnn7.0.tar.gz

After extraction, install uff with the below command from the same directory(This should install things like protobuf, numpy and uff etc);

sudo pip install TensorRT-3.0.4/uff/uff-0.2.0-py2.py3-none-any.whl

After the successful installation, you shouldn’t get the error.

Hope this helps!