Unable to run deepstream_python _apps deepstream_test_1.py (and others...)

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
Xavier NX
• DeepStream Version
Whatever installs with JetPack 5.0.2
• JetPack Version (valid for Jetson only)
5.0.2
• TensorRT Version
Whatever installs with JetPack 5.0.2
• NVIDIA GPU Driver Version (valid for GPU only)
Whatever installs with JetPack 5.0.2

• Issue Type( questions, new requirements, bugs)
I’ve built (on the Xavier) and installed the Deepstream python bindings from this repo:

I’ve installed them inside this Docker container:
nvcr.io/nvidia/deepstream-l4t:6.1.1-samples

Steps performed inside the container:

  • apt-get update
  • apt install -y git python-dev python3 python3-pip python3.8-dev cmake g++ build-essential libglib2.0-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
  • apt install libcairo2-dev pkg-config python3-dev
  • rm /usr/bin/pip3
  • apt reinstall python3-pip
  • pip3 install --upgrade pip
  • pip install pycairo
  • cd /opt/nvidia/deepstream/deepstream/sources/apps/
  • git clone GitHub - NVIDIA-AI-IOT/deepstream_python_apps: DeepStream SDK Python bindings and sample applications
  • cd deepstream_python_apps/
  • git submodule update --init
  • apt-get install --reinstall ca-certificates
  • apt install python3-gi python3-dev python3-gst-1.0 python-gi-dev git python-dev python3 python3-pip python3.8-dev cmake g++ build-essential libglib2.0-dev libglib2.0-dev-bin libgstreamer1.0-dev libtool m4 autoconf automake libgirepository1.0-dev libcairo2-dev
  • cd 3rdparty/gst-python/
  • ./autogen.sh
  • Make && make install
  • cd /opt/nvidia/deepstream/deepstream/sources/apps/deepstream_python_apps/bindings
  • Mkdir build
  • Cd build
  • cp /home_nvidia/Downloads/pyds-1.1.4-py3-none-linux_aarch64.whl .
  • pip3 install pyds-1.1.4-py3-none-linux_aarch64.whl
  • cd /opt/nvidia/deepstream/deepstream/sources/apps/deepstream_python_apps/
  • mv apps/* ./
  • cd deepstream-test1/
  • python3 deepstream_test_1.py …/…/…/…/samples/streams/sample_qHD.h264

I’m trying to run deepstream_test_1.py, but get this error:
Creating Pipeline

Creating Source

Creating H264Parser

Creating Decoder

Creating EGLSink

Playing file /deepstream-6.1/samples/streams/sample_720p.h264
Adding elements to Pipeline

Linking elements in the Pipeline

Starting pipeline

Using winsys: x11
Opening in BLOCKING MODE
0:00:00.639513086 91 0x1a57fe30 WARN nvinfer gstnvinfer.cpp:643: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
0:00:05.971814988 91 0x1a57fe30 INFO nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1909> [UID = 1]: deserialized trt engine from :/deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
INFO: [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:06.049104417 91 0x1a57fe30 INFO nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger: NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2012> [UID = 1]: Use deserialized engine model: /deepstream-6.1/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
0:00:06.062082097 91 0x1a57fe30 INFO nvinfer gstnvinfer_impl.cpp:328:notifyLoadModelStatus: [UID 1]: Load new model:dstest1_pgie_config.txt sucessfully
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Frame Number=0 Number of Objects=10 Vehicle_count=6 Person_count=4
0:00:06.367161534 91 0x1a118ea0 WARN nvinfer gstnvinfer.cpp:2300:gst_nvinfer_output_loop: error: Internal data stream error.
0:00:06.367267741 91 0x1a118ea0 WARN nvinfer gstnvinfer.cpp:2300:gst_nvinfer_output_loop: error: streaming stopped, reason error (-5)
Error: gst-stream-error-quark: Internal data stream error. (1): /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(2300): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:primary-inference:
streaming stopped, reason error (-5)

I get the same error when I try to run some of the other test applications.

After some reading, I see I should try a basic Gstreamer command to see if that works. So I’ve run the following command both directly on the Xavier and also inside the Docker container on the Xavier:

gst-launch-1.0 videotestsrc ! nvvidconv ! nvegltransform ! nveglglessink

The command shows the test pattern video when run directly from the Xavier, but when running from inside the container I get this error (which is similar to the above error):
Setting pipeline to PAUSED …

Using winsys: x11
Pipeline is PREROLLING …
Got context from element ‘eglglessink0’: gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
Freeing pipeline …

I’m not sure if it’s relevant, but I used this command to start the docker container on the Xavier:

docker run -ti --runtime nvidia --gpus all --network host -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/nvidia/:/home_nvidia -p 127.0.0.1:8888:8888 --device /dev/video0 nvcr.io/nvidia/deepstream-l4t:6.1.1-samples

I’ve done a decent bit of searching but am not finding any obvious issues.
Any help would be appreciated, thanks.

Seems the python staffs is not installed properly, please refer to the steps in FAQ DeepStream SDK FAQ - #22 by mchi on the installation.

After running apt-get update in the container and then attempting to install the prerequisites (as per your link above), I get this error:

root@ubuntu:/opt/nvidia/deepstream/deepstream/sources/apps/deepstream_python_apps/bindings/build# apt install -y git python-dev python3 python3-pip python3.6-dev python3.8-dev cmake g++ build-essential libglib2.0-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘python-dev-is-python2’ instead of ‘python-dev’
E: Unable to locate package python3.6-dev
E: Couldn’t find any package by glob ‘python3.6-dev’

I modified the installation process from

to solve the error above regarding installation of python3.6-dev package:

  • 1. Prerequisites

  • apt-get update
  • 1. (my modifications: for python3.6 & python3.6-dev)

  • apt-get install -y software-properties-common
  • apt-get update
  • add-apt-repository ppa:deadsnakes/ppa
  • apt-get update
  • apt-get install -y python3.6 python3.6-dev
  • 1. Prerequisites (cont’d from nVidia)

  • apt install -y git python-dev python3 python3-pip python3.6-dev python3.8-dev cmake g++ build-essential libglib2.0-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
  • 2. Gst-python

  • cd /opt/nvidia/deepstream/deepstream/sources/apps/
  • git clone GitHub - NVIDIA-AI-IOT/deepstream_python_apps: DeepStream SDK Python bindings and sample applications
  • cd deepstream_python_apps/
  • git submodule update --init
  • apt-get install --reinstall ca-certificates
  • cd 3rdparty/gst-python/
  • ./autogen.sh

However, now I get this error (after the above “./autogen.sh” step):

checking for GST… configure: error: Package requirements (gstreamer-1.0 >= 1.14.5) were not met:

No package ‘gstreamer-1.0’ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GST_CFLAGS
and GST_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

configure failed

To solve the above issue, I added this installation before running “./autogen.sh”:

apt install -y libgstreamer1.0-dev

Then I am able to run “make && make install”. So I continue with the instructions:

3. install pyds

cd deepstream_python_apps/bindings/
mkdir build
cd build
cmake … -DPYTHON_MAJOR_VERSION=3 -DPYTHON_MINOR_VERSION=6 -DPIP_PLATFORM=linux_aarch64 -DDS_PATH=/opt/nvidia/deepstream/deepstream
make

But running “make” results in this error:

root@ubuntu:/opt/nvidia/deepstream/deepstream/sources/apps/deepstream_python_apps/bindings/build# make
Scanning dependencies of target pyds
[ 6%] Building CXX object CMakeFiles/pyds.dir/src/pyds.cpp.o
In file included from /opt/nvidia/deepstream/deepstream/sources/apps/deepstream_python_apps/bindings/include/pyds.hpp:29,
from /opt/nvidia/deepstream/deepstream/sources/apps/deepstream_python_apps/bindings/include/bind/bindanalyticsmeta.hpp:23,
from /opt/nvidia/deepstream/deepstream/sources/apps/deepstream_python_apps/bindings/src/pyds.cpp:19:
/opt/nvidia/deepstream/deepstream/sources/includes/gstnvdsmeta.h:43:10: fatal error: gst/video/video.h: No such file or directory
43 | include <gst/video/video.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/pyds.dir/build.make:63: CMakeFiles/pyds.dir/src/pyds.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/pyds.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I can only assume this is due to the “apt install -y libgstreamer1.0-dev” above (to enable running “autogen.sh”), but I do not know…?

Sorry for the late. I will check and feedback.

I’ve attached Dockerfiles that will produce the errors listed above:

Dockerfile (1.4 KB)

Dockerfile (1.7 KB)

Seems you get python bindings installed correctly at first.
Can you follow the steps you pasted in the comment 1?
your issue in the comment 1 was display issue. try run
1: export DISPLAY=:0 //xrandr to see if display exported success or not.
2: xhost +
before running docker command.
and add option -e DISPLAY=$DISPLAY in the docker command.

Those steps have solved the problem. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.