Program being aborted on import pyds

• Hardware Platform (Jetson / GPU) dGPU RTX3070Ti
• DeepStream Version 7.0
• TensorRT Version 8.6
• NVIDIA GPU Driver Version (valid for GPU only) 551.76
• Issue Type( questions, new requirements, bugs) bug

I have install pyds using this deepstream_python_apps/bindings at master · NVIDIA-AI-IOT/deepstream_python_apps · GitHub. Everything was installed correctly but when I ran my python script with pyds imported and the code Aborted :

[NvMultiObjectTracker] Initialized
0:00:06.946069762  2753 0x561cd82e2ae0 INFO                 nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger:<pgie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:2095> [UID = 1]: deserialized trt engine from :/opt/nvidia/deepstream/deepstream-7.0/samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b1_gpu0_int8.engine
INFO: ../nvdsinfer/nvdsinfer_model_builder.cpp:612 [Implicit Engine Info]: layers num: 3
0   INPUT  kFLOAT input_1         3x544x960
1   OUTPUT kFLOAT output_bbox/BiasAdd 16x34x60
2   OUTPUT kFLOAT output_cov/Sigmoid 4x34x60

0:00:07.148942272  2753 0x561cd82e2ae0 INFO                 nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger:<pgie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2198> [UID = 1]: Use deserialized engine model: /opt/nvidia/deepstream/deepstream-7.0/samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b1_gpu0_int8.engine
0:00:07.160023728  2753 0x561cd82e2ae0 INFO                 nvinfer gstnvinfer_impl.cpp:343:notifyLoadModelStatus:<pgie> [UID 1]: Load new model:pgie-config.txt sucessfully
Aborted

When I removed import pyds statement it worked well.

Can deepstream-test1/deepstream-test2/deepstream-test3 run normally?

Does your python script import tensorrt?

Yes.

No.

Can you share a sample that reproduces the problem? I can’t tell where the problem is.

Sure, here is the .txt version of python script. I took config files from deepstream-test2 app.
code.txt (5.9 KB)

This issue seems to be related to gi.

The Glib and Gst Modules are dynamic imported by gi, and the pyds depends GLib(native).

Therefore, you need to full import of GLib/Gst before import pyds

Like below.

import gi
gi.require_version('Gst', '1.0')
from gi.repository import GLib, Gst

import pyds

This worked. Thank you very much!