AttributeError: 'NoneType' object has no attribute 'set_property'

The following error while trying to run deepstream-test1 app
python3 deepstream_test_1.py /opt/nvidia/deepstream/deepstream-6.2/samples/streams/sample_1080p_h264.mp

Playing file /opt/nvidia/deepstream/deepstream-6.2/samples/streams/sample_1080p_h264.mp4
Traceback (most recent call last):
File “deepstream_test_1.py”, line 258, in
sys.exit(main(sys.argv))
File “deepstream_test_1.py”, line 201, in main
pgie.set_property(‘config-file-path’, “dstest1_pgie_config.txt”)
AttributeError: ‘NoneType’ object has no attribute ‘set_property’

The config file “dstest1_pgie_config.txt” should be in the same directory as deepstream_test_1.py, this is the default status after cloning the deepstream_python_apps.
And test1 accepts h264 stream, you can use file sample_1080p_h264.h264 instead of sample_1080p_h264.mp4.

Similar error even dstest1_pgie_config.txt file in same folder
root@MSI:/opt/nvidia/deepstream/deepstream-6.2/sources/deepstream_python_apps/apps/deepstream-test1# python3 deepstream_test_1.py /opt/nvidia/deepstream/deepstream-6.2/samples/streams/sample_720p.h264
Creating Pipeline

Creating Source

Creating H264Parser

Creating Decoder

Unable to create pgie
Creating EGLSink

Playing file /opt/nvidia/deepstream/deepstream-6.2/samples/streams/sample_720p.h264
Traceback (most recent call last):
File “deepstream_test_1.py”, line 258, in
sys.exit(main(sys.argv))
File “deepstream_test_1.py”, line 201, in main
pgie.set_property(‘config-file-path’, “dstest1_pgie_config.txt”)
AttributeError: ‘NoneType’ object has no attribute ‘set_property’
root@MSI:/opt/nvidia/deepstream/deepstream-6.2/sources/deepstream_python_apps/apps/deepstream-test1# la
README deepstream_test_1.py dstest1_pgie_config.txt
root@MSI:/opt/nvidia/deepstream/deepstream-6.2/sources/deepstream_python_apps/apps/deepstream-test1#

Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
• The pipeline being used


Are you running in docker?
It seems to be a problem with your environment.
First, you can install deepstream step by step by referring to the link below:
https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Quickstart.html#jetson-setup
Second, you should install the python binding step by step by referring to the link below:

Please make sure the version of DeepStream when you install it.

Hardware platform : Nvidia A2
Deepstream version: 6.2
TensorRT version:8.5.2.2
Driver Version: 525.105.17
CUDA Version: 12.0

Now I have reinstalled everything on Ubuntu 20.04 now getting the following error
alluvium@alluvium-ESC4000A-E10:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test1$ python3 deepstream_test_1.py /opt/nvidia/deepstream/deepstream-6.2/samples/streams/sample_720p.h264
Creating Pipeline

Creating Source

Creating H264Parser

Creating Decoder

Creating EGLSink

Playing file /opt/nvidia/deepstream/deepstream-6.2/samples/streams/sample_720p.h264
Adding elements to Pipeline

Linking elements in the Pipeline

Starting pipeline

libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI2: failed to authenticate
0:00:00.320159341 46292 0x42ee0c0 WARN nvinfer gstnvinfer.cpp:677:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::initialize() <nvdsinfer_context_impl.cpp:1170> [UID = 1]: Warning, OpenCV has been deprecated. Using NMS for clustering instead of cv::groupRectangles with topK = 20 and NMS Threshold = 0.5
WARNING: [TRT]: CUDA lazy loading is not enabled. Enabling it can significantly reduce device memory usage. See CUDA_MODULE_LOADING in CUDA C++ Programming Guide
WARNING: …/nvdsinfer/nvdsinfer_model_builder.cpp:1487 Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-6.2/sources/deepstream_python_apps/apps/deepstream-test1/…/…/…/…/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error
0:00:02.899001023 46292 0x42ee0c0 WARN nvinfer gstnvinfer.cpp:677:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1897> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-6.2/sources/deepstream_python_apps/apps/deepstream-test1/…/…/…/…/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed
0:00:03.012810418 46292 0x42ee0c0 WARN nvinfer gstnvinfer.cpp:677:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2002> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-6.2/sources/deepstream_python_apps/apps/deepstream-test1/…/…/…/…/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed, try rebuild
0:00:03.012860765 46292 0x42ee0c0 INFO nvinfer gstnvinfer.cpp:680:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1923> [UID = 1]: Trying to create engine from model files
WARNING: [TRT]: CUDA lazy loading is not enabled. Enabling it can significantly reduce device memory usage. See CUDA_MODULE_LOADING in CUDA C++ Programming Guide
WARNING: [TRT]: The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible.
WARNING: …/nvdsinfer/nvdsinfer_model_builder.cpp:1459 Serialize engine failed because of file path: /opt/nvidia/deepstream/deepstream-6.2/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine opened error
0:00:31.291998164 46292 0x42ee0c0 WARN nvinfer gstnvinfer.cpp:677:gst_nvinfer_logger: NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1950> [UID = 1]: failed to serialize cude engine to file: /opt/nvidia/deepstream/deepstream-6.2/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
WARNING: [TRT]: CUDA lazy loading is not enabled. Enabling it can significantly reduce device memory usage. See CUDA_MODULE_LOADING in CUDA C++ Programming Guide
INFO: …/nvdsinfer/nvdsinfer_model_builder.cpp:610 [Implicit Engine Info]: layers num: 3
0 INPUT kFLOAT input_1 3x368x640
1 OUTPUT kFLOAT conv2d_bbox 16x23x40
2 OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40

0:00:31.410980527 46292 0x42ee0c0 INFO nvinfer gstnvinfer_impl.cpp:328:notifyLoadModelStatus: [UID 1]: Load new model:dstest1_pgie_config.txt sucessfully
cuGraphicsGLRegisterBuffer failed with error(219) gst_eglglessink_cuda_init texture = 1
Frame Number=0 Number of Objects=12 Vehicle_count=8 Person_count=4
0:00:31.739648733 46292 0x36df2a0 WARN nvinfer gstnvinfer.cpp:2369:gst_nvinfer_output_loop: error: Internal data stream error.
0:00:31.739675334 46292 0x36df2a0 WARN nvinfer gstnvinfer.cpp:2369:gst_nvinfer_output_loop: error: streaming stopped, reason not-negotiated (-4)
Error: gst-stream-error-quark: Internal data stream error. (1): gstnvinfer.cpp(2369): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:primary-inference:
streaming stopped, reason not-negotiated (-4)
Frame Number=1 Number of Objects=11 Vehicle_count=8 Person_count=3
Frame Number=2 Number of Objects=11 Vehicle_count=7 Person_count=4
nvstreammux: Successfully handled EOS for source_id=0
Frame Number=3 Number of Objects=13 Vehicle_count=8 Person_count=5
Frame Number=4 Number of Objects=12 Vehicle_count=8 Person_count=4
Frame Number=5 Number of Objects=12 Vehicle_count=8 Person_count=4
Frame Number=6 Number of Objects=11 Vehicle_count=7 Person_count=4

The error number 219 means:

CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219
This indicates an error with OpenGL or DirectX context.

Do you have a monitor ? nveglglessink may not work without physical monitor.

If you can’t plug in a monitor, use fakesink replace nveglglessink.

There is a similar issue to refer

Thanks

1 Like

I have connected the monitor but still produces the same error, does a monitor connected via a VGA cable make a difference?
With fakesink the code ran successfully,all 1441 frames were processed but I am not able to see the video stream output.
Besides fakesink i have tried ximagesink and autovideosink but nothing worked

error
cuGraphicsGLRegisterBuffer failed with error(219) gst_eglglessink_cuda_init texture = 1
Frame Number=0 Number of Objects=12 Vehicle_count=8 Person_count=4
0:00:31.732148984 20482 0x344b6a0 WARN nvinfer gstnvinfer.cpp:2369:gst_nvinfer_output_loop: error: Internal data stream error.
0:00:31.732163823 20482 0x344b6a0 WARN nvinfer gstnvinfer.cpp:2369:gst_nvinfer_output_loop: error: streaming stopped, reason not-negotiated (-4)
Error: gst-stream-error-quark: Internal data stream error. (1): gstnvinfer.cpp(2369): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:primary-inference:
streaming stopped, reason not-negotiated (-4)
Frame Number=1 Number of Objects=11 Vehicle_count=8 Person_count=3
Frame Number=2 Number of Objects=11 Vehicle_count=7 Person_count=4
nvstreammux: Successfully handled EOS for source_id=0
Frame Number=3 Number of Objects=13 Vehicle_count=8 Person_count=5
Frame Number=4 Number of Objects=12 Vehicle_count=8 Person_count=4
Frame Number=5 Number of Objects=12 Vehicle_count=8 Person_count=4
Frame Number=6 Number of Objects=11 Vehicle_count=7 Person_count=4

1.Your gpu is compute card, not for display
you may follow this link for setting up virtual display, https://elinux.org/Deepstream/FAQ

If the VGA is from the cpu, it may not work.

2.ximagesink and autovideosink can’t use as video output.
Because DeepStream use nv hardware buffer, incompatible with ximagesink or autovideosink.

another options, If fakesink works well, you can store the output as mp4

Thanks