Error importing Logger attribute in python

Description

Hi,

I’m trying to do model inference in my Jetson Nano. I have a pretrained ResNet50 in onnx format that I want to read with TensorRT. My code just does:

import tensorrt as trt

TRT_LOGGER = trt.Logger(trt.Logger.WARNING)

But get the following exception:

AttributeError: module ‘tensorrt’ has no attribute ‘Logger’

The installation of TensorRT that I’m using is the one that comes prinstalled in Jetson Nano

Should I delete and reinstall it, or am I doing something wrong?

Thanks in advance.

Environment

TensorRT Version: 7.1.3
GPU Type: 128-core Maxwell
CUDA Version: 10.2.89
CUDNN Version: 8.0.0
Operating System + Version: Ubuntu 18.04.5 LTS (Jetson Nano)
Python Version (if applicable): 3.6.9

Hi @imartgarr,

We recommend you to reinstall the tensorrt.
For your reference,
https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html

Thank you.

@spolisetty I am also facing exactly same issue and i have also tried uninstalling TensorRT and Installing again but no luck. Any idea why?
I am sucessufully able to import tensorrt as trt but i have no idea why Looger module is not found.

import io, os
import logging
import tensorrt as trt
import time
from PIL import Image
import numpy as np
import pycuda.driver as cuda
import pycuda.autoinit

def load_engine(trt_runtime, engine_path):
    #trt.init_libnvinfer_plugins(None, "") 
    with open(engine_path, 'rb') as f:
        engine_data = f.read()
    engine = trt_runtime.deserialize_cuda_engine(engine_data)
    return engine

#TRT_LOGGER = logging.debug('This is a debug message')
TRT_LOGGER = trt.Logger(trt.Logger.WARNING)
trt_runtime = trt.Runtime(TRT_LOGGER)
trt_engine_path = "/home/adas/samples/my_engine.trt"
trt_engine = load_engine(trt_runtime, trt_engine_path)

if trt_engine is not None:
    print("Success")                                      
else:
    print("Failed")
Traceback (most recent call last):
  File "./nvidia_inference.py", line 19, in <module>
    TRT_LOGGER = trt.Logger(trt.Logger.INFO)
AttributeError: module 'tensorrt' has no attribute 'Logger'

TensorRT Version : 8.2
GPU Type : Quadro RTX 5000
Nvidia Driver Version :470.42.01
CUDA Version : 11.4