ImportError: No module named 'tensorrt.parsers'

When trying to run the following Python code:
import tensorrt as trt
from tensorrt.parsers import uffparser
import uff

I receive “ImportError: No module named ‘tensorrt.parsers’”.
Additional details: Python version is 3.5.2. I use TensorRT 5.0RC with CUDA 9.0.
Note that tensorrt is imported successfully and that the TensorRT installation was verified.

Hello,

we’ve reproduced the issue locally and are reviewing. will keep you updated.

Hello,

The format has changed with the new python API. The documentation has more details on how this can be done.
https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#import_model_python

You would do something like this with the new API
with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.CaffeParser() as parser:


To continue using the legacy API, you would need to import tensorrt.legacy instead of import tensorrt

Regards,
NVIDIA Enterprise Support

1 Like

Thanks @NVES, this helped me a lot !