Deserialize engine failed because file path: .../resnet10.caffemodel_b1_gpu0_int8.engine open error

I am trying to execute the example here deepstream_python_apps/apps/deepstream-imagedata-multistream at master · NVIDIA-AI-IOT/deepstream_python_apps · GitHub

The example generates the following error:

Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error

Full output:

Frames will be saved in  frames
Creating Pipeline 
 
Creating streamux 
 
Creating source_bin  0  
 
Creating source bin
source-bin-00
Creating Pgie 
 
Creating nvvidconv1 
 
Creating filter1 
 
Creating tiler 
 
Creating nvvidconv 
 
Creating nvosd 
 
Creating EGLSink 

Atleast one of the sources is live
Adding elements to Pipeline 

Linking elements in the Pipeline 

Now playing...
1 :  rtsp://localhost/cbb48b92-f74d-4ad5-b8a9-3affbefcc17e_default/12802797-227b-4066-9f22-09745b012762
Starting pipeline 

ERROR: ../nvdsinfer/nvdsinfer_model_builder.cpp:1484 Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error
0:00:02.436358866  3766      0x3b750d0 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1889> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed
0:00:02.436436696  3766      0x3b750d0 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1996> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed, try rebuild
0:00:02.436461928  3766      0x3b750d0 INFO                 nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1914> [UID = 1]: Trying to create engine from model files
WARNING: ../nvdsinfer/nvdsinfer_model_builder.cpp:1210 INT8 not supported by platform. Trying FP16 mode.
WARNING: ../nvdsinfer/nvdsinfer_model_builder.cpp:1224 FP16 not supported by platform. Using FP32 mode.
WARNING: [TRT]: Detected invalid timing cache, setup a local cache instead
ERROR: ../nvdsinfer/nvdsinfer_model_builder.cpp:1456 Serialize engine failed because of file path: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_fp32.engine opened error
0:00:11.521725995  3766      0x3b750d0 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1942> [UID = 1]: failed to serialize cude engine to file: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_fp32.engine
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:11.527632843  3766      0x3b750d0 INFO                 nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary-inference> [UID 1]: Load new model:dstest_imagedata_config.txt sucessfully
Decodebin child added: source 

Decodebin child added: decodebin0 

Decodebin child added: rtph264depay0 

Decodebin child added: h264parse0 

Decodebin child added: capsfilter0 

Decodebin child added: nvv4l2decoder0 

In cb_newpad

/home/ubuntu/pycharm/projects/fususcore-ai-detector-nvidia/etc/aws/python3: line 56:  3766 Bus error               (core dumped) /home/ubuntu/pycharm/venv/bin/python3 "$@"

Process finished with exit code 135 (interrupted by signal 7: SIGEMT)

Setup:

  • Ubuntu 18.04
  • Deepstream 6.0
  • Python 3.6
  • Cuda 11.4.100
  • Drivers 470.82.00
  • Tesla M60

pip3 freeze:

absl-py==1.0.0
aiocontextvars==0.2.2
aiohttp==3.8.1
aiosignal==1.2.0
appdirs==1.4.4
asn1crypto==0.24.0
async-timeout==4.0.1
asynctest==0.13.0
attrs==17.4.0
Automat==0.6.0
av==8.0.3
awscli==1.18.69
backcall==0.2.0
bidict==0.21.4
blinker==1.4
boto3==1.17.4
botocore==1.20.4
cachetools==4.2.4
certifi==2018.1.18
chardet==4.0.0
charset-normalizer==2.0.7
click==7.1.2
cloud-init==21.2
colorama==0.3.7
command-not-found==0.3
configobj==5.0.6
constantly==15.1.0
contextlib2==0.6.0.post1
contextvars==2.4
cronex==0.1.3.1
cryptography==2.1.4
cupy-cuda113==9.6.0
cycler==0.11.0
Cython==0.29.24
dataclasses==0.8
decorator==5.1.0
dill==0.3.4
distro-info===0.18ubuntu0.18.04.1
docutils==0.14
ec2-hibinit-agent==1.0.0
fastrlock==0.8
filterpy==1.4.5
frozenlist==1.2.0
fsspec==2021.11.0
future==0.18.2
google-auth==2.3.3
google-auth-oauthlib==0.4.6
grpcio==1.42.0
hibagent==1.0.1
httplib2==0.9.2
hyperlink==17.3.1
icc-rt==2020.0.133
idna==2.10
idna-ssl==1.1.0
imageio==2.10.5
immutables==0.16
importlib-metadata==4.8.2
incremental==16.10.1
influxdb==5.3.1
intel-openmp==2020.0.133
ipython==7.16.1
ipython-genutils==0.2.0
jedi==0.18.1
Jinja2==2.10
jmespath==0.9.3
jsonpatch==1.16
jsonpointer==1.10
jsonschema==2.6.0
keyring==10.6.0
keyrings.alt==3.0
kiwisolver==1.3.1
language-selector==0.1
llvmlite==0.36.0
loguru==0.5.3
Mako==1.1.6
Markdown==3.3.6
MarkupSafe==1.0
matplotlib==3.3.4
motpy==0.0.8
msgpack==1.0.2
multidict==5.2.0
multiprocess==0.70.12.2
netifaces==0.10.4
numba==0.53.1
numpy==1.19.5
oauthlib==3.1.1
olefile==0.45.1
onnx==1.10.2
openvino==2021.4.2
packaging==21.2
PAM==0.4.2
pandas==1.1.5
parso==0.8.2
pathos==0.2.8
pexpect==4.2.1
pgi==0.0.11.2
pickleshare==0.7.5
Pillow==8.4.0
pkg_resources==0.0.0
pox==0.3.0
ppft==1.6.6.4
prompt-toolkit==3.0.22
protobuf==3.19.1
psutil==5.8.0
pyasn1==0.4.2
pyasn1-modules==0.2.1
pycocotools==2.0.2
pycrypto==2.6.1
pycuda==2020.1
pyDeprecate==0.3.1
pyds @ file:///home/ubuntu/pycharm/libs/deepstream_python_apps/bindings/build/pyds-1.1.0-py3-none-linux_x86_64.whl
Pygments==2.2.0
PyGObject==3.26.1
pyjnius==1.4.1
PyJWT==1.5.3
pyOpenSSL==17.5.0
pyparsing==2.4.7
pyserial==3.4
python-apt==1.6.5+ubuntu0.7
python-dateutil==2.8.1
python-debian==0.1.32
python-engineio==4.2.1
python-socketio==5.4.0
pytools==2021.2.9
pytorch-ignite==0.4.7
pytorch-lightning==1.5.2
pytz==2021.3
pyxdg==0.25
PyYAML==5.3.1
requests==2.25.1
requests-oauthlib==1.3.0
requests-unixsocket==0.1.5
roman==2.0.0
rsa==3.4.2
s3transfer==0.3.3
schedule==1.0.0
schema==0.7.4
scipy==1.5.4
screen-resolution-extra==0.0.0
seaborn==0.11.2
SecretStorage==2.3.1
sentry-sdk==0.19.5
service-identity==16.0.0
six==1.11.0
snowy==0.0.9
sos==4.1
ssh-import-id==5.7
supervisor==4.2.1
systemd-python==234
tabulate==0.8.9
tensorboard==2.7.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorrt==8.0.1.6
thop==0.0.31.post2005241907
toml==0.10.2
torch==1.10.0+cu113
torch-tensorrt==1.0.0
torchmetrics==0.6.0
torchsummary==1.5.1
torchvision==0.11.1+cu113
tqdm==4.56.0
traitlets==4.3.3
Twisted==17.9.0
typed-ast==1.4.2
typing_extensions==4.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.26.7
wcwidth==0.2.5
webcolors==1.11.1
websocket-client==0.57.0
Werkzeug==2.0.2
xkit==0.0.0
yarl==1.7.2
zipp==3.6.0
zope.interface==4.3.2

dpkg -l | grep nvinfer:

ii  libnvinfer-bin                                                    8.0.1-1+cuda11.3                    amd64        TensorRT binaries
ii  libnvinfer-dev                                                    8.0.1-1+cuda11.3                    amd64        TensorRT development libraries and headers
ii  libnvinfer-doc                                                    8.0.1-1+cuda11.3                    all          TensorRT documentation
ii  libnvinfer-plugin-dev                                             8.0.1-1+cuda11.3                    amd64        TensorRT plugin libraries
ii  libnvinfer-plugin8                                                8.0.1-1+cuda11.3                    amd64        TensorRT plugin libraries
ii  libnvinfer-samples                                                8.0.1-1+cuda11.3                    all          TensorRT samples
ii  libnvinfer8                                                       8.0.1-1+cuda11.3                    amd64        TensorRT runtime libraries
ii  python3-libnvinfer                                                8.0.1-1+cuda11.3                    amd64        Python 3 bindings for TensorRT

ls /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/:

cal_trt.bin  labels.txt  resnet10.caffemodel  resnet10.prototxt

Looking at the log however I see that Load new model:dstest_imagedata_config.txt sucessfully so I am wondering if the Bus error is related to that or not.

After restarting the output is the following:

ssh://ubuntu@3.88.166.118:22/home/ubuntu/pycharm/projects/fususcore-ai-detector-nvidia/etc/aws/python3 -u /home/ubuntu/pycharm/projects/fususcore-ai-detector-nvidia/src/deepstream/test_1.py rtsp://localhost/cbb48b92-f74d-4ad5-b8a9-3affbefcc17e_default/12802797-227b-4066-9f22-09745b012762 frames
Number of sources: 1
Frames will be saved in  frames
Creating Pipeline 
 
Creating streamux 
 
Creating source_bin  0  
 
Creating source bin
source-bin-00
Creating Pgie 
 
Creating nvvidconv1 
 
Creating filter1 
 
Creating tiler 
 
Creating nvvidconv 
 
Creating nvosd 
 
Creating EGLSink 

Atleast one of the sources is live
Adding elements to Pipeline 

Linking elements in the Pipeline 

Now playing...
1 :  rtsp://localhost/cbb48b92-f74d-4ad5-b8a9-3affbefcc17e_default/12802797-227b-4066-9f22-09745b012762
Starting pipeline 

ERROR: ../nvdsinfer/nvdsinfer_model_builder.cpp:1484 Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error
0:00:02.440642566 24784      0x2ba2ad0 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1889> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed
0:00:02.440731372 24784      0x2ba2ad0 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1996> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed, try rebuild
0:00:02.440757412 24784      0x2ba2ad0 INFO                 nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1914> [UID = 1]: Trying to create engine from model files
WARNING: ../nvdsinfer/nvdsinfer_model_builder.cpp:1210 INT8 not supported by platform. Trying FP16 mode.
WARNING: ../nvdsinfer/nvdsinfer_model_builder.cpp:1224 FP16 not supported by platform. Using FP32 mode.
WARNING: [TRT]: Detected invalid timing cache, setup a local cache instead
ERROR: ../nvdsinfer/nvdsinfer_model_builder.cpp:1456 Serialize engine failed because of file path: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_fp32.engine opened error
0:00:11.410956760 24784      0x2ba2ad0 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1942> [UID = 1]: failed to serialize cude engine to file: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_fp32.engine
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:11.416641329 24784      0x2ba2ad0 INFO                 nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary-inference> [UID 1]: Load new model:dstest_imagedata_config.txt sucessfully
Decodebin child added: source 

Decodebin child added: decodebin0 

Decodebin child added: rtph264depay0 

Decodebin child added: h264parse0 

Decodebin child added: capsfilter0 

Decodebin child added: nvv4l2decoder0 

In cb_newpad

Frame Number= 0 Number of Objects= 1 Vehicle_count= 1 Person_count= 0
0:00:13.788922301 24784      0x1f0e5e0 WARN                 nvinfer gstnvinfer.cpp:2288:gst_nvinfer_output_loop:<primary-inference> error: Internal data stream error.
0:00:13.788953021 24784      0x1f0e5e0 WARN                 nvinfer gstnvinfer.cpp:2288:gst_nvinfer_output_loop:<primary-inference> error: streaming stopped, reason not-negotiated (-4)
Error: gst-stream-error-quark: Internal data stream error. (1): gstnvinfer.cpp(2288): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:primary-inference:
streaming stopped, reason not-negotiated (-4)
Exiting app


Process finished with exit code 0

It seems to stop always after processing the first frame.
I also tried with the following public stream without solving rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov .

Not sure if this is related but I am running over SSH.

could you try ds docker to rule out the setup issue?

Thanks!

I opened a bash into nvcr.io/nvidia/deepstream:6.0-samples. I tried to run the example but Python cannot find the module gi. Therefore I tried to compile and install the bindings. New error during autogen.sh execution.

ln: failed to create symbolic link '.git/hooks/pre-commit': Not a directory
+ check for build tools
  checking for autoconf >= 2.60 ... found 2.69, ok.
  checking for automake >= 1.10 ... found 1.15.1, ok.
  checking for libtoolize >= 1.5.0 ... found 2.4.6, ok.
  checking for pkg-config >= 0.8.0 ... found 0.29.1, ok.
+ checking for autogen.sh options
  This autogen script will automatically run ./configure as:
  ./configure --enable-maintainer-mode
  To pass any additional options, please specify them on the ./autogen.sh
  command line.
+ running libtoolize --copy --force...
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
+ running aclocal -I m4 -I common/m4 ...
+ running autoheader ...
+ running autoconf ...
+ running automake -a -c -Wno-portability...
configure.ac:47: installing './compile'
configure.ac:10: installing './config.guess'
configure.ac:10: installing './config.sub'
configure.ac:13: installing './install-sh'
configure.ac:13: installing './missing'
Makefile.am: installing './INSTALL'
gi/overrides/Makefile.am: installing './depcomp'
gi/overrides/Makefile.am:7: installing './py-compile'
plugin/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
+ running configure ... 
  ./configure default flags: --enable-maintainer-mode

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking nano version... 0 (release)
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... no
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for gcc option to accept ISO C99... none needed
checking for gcc option to accept ISO Standard C... (cached) none needed
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/dist-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/dist-packages
checking for python >= 2.7... checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
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

According to your website this container is the one for:

DeepStream samples docker (contains the runtime libraries, GStreamer plugins, reference applications and sample streams, models and configs)

EDIT 1: you need export GIT_SSL_NO_VERIFY=true to be able to run autogen.sh to compile deepstream python bindings.

EDIT 2: I can compile it after installing sudo apt-get install libgstreamer1.0-dev. Please, include it in the requirements on the git repository.

Now I have an error at compile time for the bindings:

[  6%] Building CXX object CMakeFiles/pyds.dir/src/pyds.cpp.o
In file included from /opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/bindings/include/pyds.hpp:29:0,
                 from /opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/bindings/include/bind/bindanalyticsmeta.hpp:23,
                 from /opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/bindings/src/pyds.cpp:19:
/opt/nvidia/deepstream/deepstream-6.0/sources/includes/gstnvdsmeta.h:43:10: fatal error: gst/video/video.h: No such file or directory
 #include <gst/video/video.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/pyds.dir/build.make:62: recipe for target 'CMakeFiles/pyds.dir/src/pyds.cpp.o' failed
make[2]: *** [CMakeFiles/pyds.dir/src/pyds.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/pyds.dir/all' failed
make[1]: *** [CMakeFiles/pyds.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

EDIT 3: solved with apt-get install libgstreamer-plugins-base1.0-dev

EDIT 4: also the following are required:

pip3 install --upgrade pip   # won't work without this
pip3 install numpy opencv-python

EDIT 5: the deepstream python sample won’t find the plugins. You need to run export GST_PLUGIN_PATH="/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream:${GST_PLUGIN_PATH}"

EDIT 6: I finally got to have the application starting. It seems to be stalled. VRAM usage is 3%. GPU usage 0%.

Frames will be saved in  frames
Creating Pipeline

Creating streamux

Creating source_bin  0

Creating source bin
source-bin-00
Creating Pgie

Creating nvvidconv1

Creating filter1

Creating tiler

Creating nvvidconv

Creating nvosd

Creating EGLSink

Atleast one of the sources is live
Adding elements to Pipeline

Linking elements in the Pipeline

Now playing...
1 :  rtsp://localhost/cbb48b92-f74d-4ad5-b8a9-3affbefcc17e_default/0d943055-d4f2-49d2-a8fa-189176228ae1
Starting pipeline

Could you please provide an example on how to run the tutorial within the container?

I managed to create a dockerfile to run the example:

FROM nvcr.io/nvidia/deepstream:6.0-samples
ENV GIT_SSL_NO_VERIFY=1
RUN apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
RUN 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
RUN pip3 install --upgrade pip
RUN pip3 install numpy opencv-python
ENV GST_PLUGIN_PATH="/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream:${GST_PLUGIN_PATH}"
ENV GST_PLUGIN_PATH="/opt/nvidia/deepstream/deepstream-6.0/lib/gst-plugins:${GST_PLUGIN_PATH}"
RUN echo '/usr/local/lib/gstreamer-1.0' >> /etc/ld.so.conf
RUN ldconfig
ENV LD_LIBRARY_PATH="/usr/local/lib/gstreamer-1.0:$LD_LIBRARY_PATH"
ENV LD_RUN_PATH="/usr/local/lib/gstreamer-1.0:$LD_RUN_PATH"
# RUN source ~/.bashrc
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources && \
    git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources/deepstream_python_apps && \
    git submodule update --init
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources/deepstream_python_apps/3rdparty/gst-python && \
    ./autogen.sh &&  \
    make &&  \
    make install
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources/deepstream_python_apps/bindings && \
    mkdir build && \
    cd build && \
    cmake .. && \
    make && \
    pip3 install pyds-1.1.0-py3-none-linux_x86_64.whl
# docker build . -t deepstream-custom
# docker run --gpus '"'device=0'"' -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream-6.0/sources/deepstream_python_apps/apps deepstream-custom
# python3 deepstream_imagedata-multistream.py rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov frames

To run it:

docker build . -t deepstream-custom
docker run --gpus '"'device=0'"' -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream-6.0/sources/deepstream_python_apps/apps deepstream-custom
cd deepstream-imagedata-multistream

Then, within the container:

python3 deepstream_imagedata-multistream.py rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov frames

The problem is that Gstreamer cannot find a variety of plugins into /opt/nvidia/deepstream/deepstream-6.0/lib/gst-plugins.
ERROR:

Frames will be saved in  frames

(gst-plugin-scanner:20): GStreamer-WARNING **: 22:57:01.638: Failed to load plugin '/opt/nvidia/deepstream/deepstream-6.0/lib/gst-plugins/libnvdsgst_udp.so': librivermax.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:20): GStreamer-WARNING **: 22:57:01.646: Failed to load plugin '/opt/nvidia/deepstream/deepstream-6.0/lib/gst-plugins/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory

(gst-plugin-scanner:20): GStreamer-WARNING **: 22:57:01.647: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:20): GStreamer-WARNING **: 22:57:01.648: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory

(gst-plugin-scanner:20): GStreamer-WARNING **: 22:57:01.836: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:20): GStreamer-WARNING **: 22:57:01.837: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory
Creating Pipeline 
 
Creating streamux 
 
Creating source_bin  0  
 
Creating source bin
source-bin-00
Creating Pgie 
 
Creating nvvidconv1 
 
Creating filter1 
 
Creating tiler 
 
Creating nvvidconv 
 
Creating nvosd 
 
Creating EGLSink 

Atleast one of the sources is live
Adding elements to Pipeline 

Linking elements in the Pipeline 

Now playing...
1 :  rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
Starting pipeline 

No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified

Continuing here Can't find librivermax.so.0 and libtritonserver.so

if you want to use triton, please use the triton docker

please fefer to deepstream_python_apps/bindings at master · NVIDIA-AI-IOT/deepstream_python_apps · GitHub
image to build the DS python binding, here are steps for reference also

please refer to deepstream_python_apps/bindings at master · NVIDIA-AI-IOT/deepstream_python_apps · GitHub and steps below if you use DS6,0GA docker -
## 1.  Prerequisites
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 https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git
cd deepstream_python_apps/
git submodule update --init
# apt-get install --reinstall ca-certificates
cd 3rdparty/gst-python/
./autogen.sh
make && make install

# 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
pip3 install ./pyds-1.1.0-py3-none-linux_x86_64.whl

# 4. run sample
cd deepstream_python_apps
mv  apps/* ./
cd deepstream-test1/
python3 deepstream_test_1.py ../../../../samples/streams/sample_qHD.h264
![image|690x361](upload://yKIofGABfyeSYJKEdsr1j5OFOI2.png)

Hi @mchi have you tried to run the steps in the deepstream docker container? They don’t seem to work. I can’t even run correctly the make to build gst-python because of an error in autogen.sh.
The Dockerfile that I showed here Can't find librivermax.so.0 and libtritonserver.so contains your exact steps with some fixes to be able to compile the libraries. However, something must be wrong since, despite being able to compile the libraries, the code won’t work.
Please, let me know if you are able to run these steps within the deepstream container. Also, I am trying to run the deepstream_imagedata-multistream, even though also deepstream-test-1 seem to have some issues.
Thank you! :)

Certainly!

Which deepstream 6 container are you using exactly?

I tried with the base one, with devel, and following your instruction I get an error at autogen which prevents make from running:

root@ed782deb08f0:/opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/3rdparty/gst-python# ./autogen.sh
+ Setting up common submodule
Submodule 'common' (https://gitlab.freedesktop.org/gstreamer/common.git) registered for path 'common'
Cloning into '/opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/3rdparty/gst-python/common'...
Submodule path 'common': checked out 'd7ecca16114e443dab9d6f8cbc47a1554e3d4b30'
ln: failed to create symbolic link '.git/hooks/pre-commit': Not a directory
+ check for build tools
  checking for autoconf >= 2.60 ... found 2.69, ok.
  checking for automake >= 1.10 ... found 1.15.1, ok.
  checking for libtoolize >= 1.5.0 ... found 2.4.6, ok.
  checking for pkg-config >= 0.8.0 ... found 0.29.1, ok.
+ checking for autogen.sh options
  This autogen script will automatically run ./configure as:
  ./configure --enable-maintainer-mode
  To pass any additional options, please specify them on the ./autogen.sh
  command line.
+ running libtoolize --copy --force...
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
+ running aclocal -I m4 -I common/m4 ...
+ running autoheader ...
+ running autoconf ...
+ running automake -a -c -Wno-portability...
configure.ac:47: installing './compile'
configure.ac:10: installing './config.guess'
configure.ac:10: installing './config.sub'
configure.ac:13: installing './install-sh'
configure.ac:13: installing './missing'
Makefile.am: installing './INSTALL'
gi/overrides/Makefile.am: installing './depcomp'
gi/overrides/Makefile.am:7: installing './py-compile'
plugin/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
+ running configure ...
  ./configure default flags: --enable-maintainer-mode

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking nano version... 0 (release)
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... no
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for gcc option to accept ISO C99... none needed
checking for gcc option to accept ISO Standard C... (cached) none needed
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/dist-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/dist-packages
checking for python >= 2.7... checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
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
root@ed782deb08f0:/opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/3rdparty/gst-python# make
make: *** No targets specified and no makefile found.  Stop.

EDIT: to be more precise, without running apt-get install --reinstall ca-certificates even autogen.sh fails:

root@7ed1581d1cf9:/opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/3rdparty/gst-python# ./autogen.sh
+ Setting up common submodule
Submodule 'common' (https://gitlab.freedesktop.org/gstreamer/common.git) registered for path 'common'
Cloning into '/opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/3rdparty/gst-python/common'...
fatal: unable to access 'https://gitlab.freedesktop.org/gstreamer/common.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
fatal: clone of 'https://gitlab.freedesktop.org/gstreamer/common.git' into submodule path '/opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/3rdparty/gst-python/common' failed
Failed to clone 'common'. Retry scheduled
Cloning into '/opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/3rdparty/gst-python/common'...
fatal: unable to access 'https://gitlab.freedesktop.org/gstreamer/common.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
fatal: clone of 'https://gitlab.freedesktop.org/gstreamer/common.git' into submodule path '/opt/nvidia/deepstream/deepstream-6.0/deepstream_python_apps/3rdparty/gst-python/common' failed
Failed to clone 'common' a second time, aborting
There is something wrong with your source tree.
You are missing common/gst-autogen.sh

EDIT2: I also noticed that the folder /opt/nvidia/deepstream/deepstream/sources/apps/ does not exists in my container, only cd /opt/nvidia/deepstream/deepstream-6.0/sources/apps/

Sample docker is just for running samples, does not support to compile and then run application.
If you want to run triton, please use the triton docker, otherwise, suggest to use the devel docker

Let me know which docker you will use.

I would like to use triton. I tried with it too but I had errors. See my last post here: Can't find librivermax.so.0 and libtritonserver.so . I also tried with devel out of curiosity but I had the same errors reported in my post above. I’d like to use triton.

for triton docker, please refer to [DeepStream 6.0] Unable to install python_gst into nvcr.io/nvidia/deepstream:6.0-triton container - #5 by rpaliwal_nvidia v

So do you need to install the deepstream sdk inside the container nvcr.io/nvidia/deepstream:6.0-triton](http://nvcr.io/nvidia/deepstream:6.0-triton ? That’s what the link says, but it seems weird.

@mchi I tried to follow the instruction but they fail at the apt-get install (both trying to install and not installing the deepstream sdk):
Dockerfile

FROM nvcr.io/nvidia/deepstream:6.0-triton
#ENV GIT_SSL_NO_VERIFY=1
RUN sh docker_python_setup.sh
RUN cd sources && \
    git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git
RUN apt install -y python3-gi python3-gst-1.0 python-gi-dev git python3 python3-pip cmake g++ build-essential \
    libglib2.0-dev python3-dev python3.6-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
COPY ./deepstream-6.0_6.0.0-1_amd64.deb ./
RUN apt -y install ./deepstream-6.0_6.0.0-1_arm64.deb
RUN cd sources/deepstream_python_apps/bindings && \
    mkdir build && \
    cd build && \
    cmake .. && \
    make && \
    pip install ./pyds-1.1.0-py3-none-linux_x86_64.whl

Output:

Sending build context to Docker daemon    704MB
Step 1/7 : FROM nvcr.io/nvidia/deepstream:6.0-triton
 ---> 6e629647efba
Step 2/7 : RUN sh docker_python_setup.sh
 ---> Running in 06c70f3e982e
Reading package lists... Done
Building dependency tree       
Reading state information... Done
software-properties-common is already the newest version (0.98.9.5).
0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.
Ign:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease
Ign:2 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  InRelease
Get:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  Release [696 B]
Get:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease [18.1 kB] 
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]      
Hit:6 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  Release
Get:7 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  Release.gpg [836 B]
Hit:8 http://archive.ubuntu.com/ubuntu focal InRelease                         
Get:9 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]        
Get:11 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  Packages [515 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:13 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 Packages [26.3 kB]
Get:14 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1326 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [784 kB]
Get:16 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [30.1 kB]
Get:17 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [726 kB]
Get:18 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [821 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1741 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1099 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [33.6 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [21.7 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.0 kB]
Fetched 7530 kB in 2s (4011 kB/s)                           
Reading package lists... Done
Ign:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease
Ign:2 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  InRelease
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease    
Hit:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  Release
Hit:5 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal InRelease              
Hit:7 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  Release
Hit:8 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:9 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython3.6-minimal libpython3.6-stdlib python3.6-minimal
Suggested packages:
  python3.6-venv python3.6-doc binfmt-support
The following NEW packages will be installed:
  libpython3.6-minimal libpython3.6-stdlib python3.6 python3.6-minimal
0 upgraded, 4 newly installed, 0 to remove and 118 not upgraded.
Need to get 4629 kB of archives.
After this operation, 24.1 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.6-minimal amd64 3.6.15-1+focal1 [577 kB]
Get:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.6-minimal amd64 3.6.15-1+focal1 [1589 kB]
Get:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.6-stdlib amd64 3.6.15-1+focal1 [2215 kB]
Get:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.6 amd64 3.6.15-1+focal1 [249 kB]
Fetched 4629 kB in 2s (1952 kB/s) 
Selecting previously unselected package libpython3.6-minimal:amd64.
(Reading database ... 69896 files and directories currently installed.)
Preparing to unpack .../libpython3.6-minimal_3.6.15-1+focal1_amd64.deb ...
Unpacking libpython3.6-minimal:amd64 (3.6.15-1+focal1) ...
Selecting previously unselected package python3.6-minimal.
Preparing to unpack .../python3.6-minimal_3.6.15-1+focal1_amd64.deb ...
Unpacking python3.6-minimal (3.6.15-1+focal1) ...
Selecting previously unselected package libpython3.6-stdlib:amd64.
Preparing to unpack .../libpython3.6-stdlib_3.6.15-1+focal1_amd64.deb ...
Unpacking libpython3.6-stdlib:amd64 (3.6.15-1+focal1) ...
Selecting previously unselected package python3.6.
Preparing to unpack .../python3.6_3.6.15-1+focal1_amd64.deb ...
Unpacking python3.6 (3.6.15-1+focal1) ...
Setting up libpython3.6-minimal:amd64 (3.6.15-1+focal1) ...
Setting up python3.6-minimal (3.6.15-1+focal1) ...
Setting up libpython3.6-stdlib:amd64 (3.6.15-1+focal1) ...
Setting up python3.6 (3.6.15-1+focal1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libpython3.6
0 upgraded, 1 newly installed, 0 to remove and 118 not upgraded.
Need to get 1570 kB of archives.
After this operation, 4778 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.6 amd64 3.6.15-1+focal1 [1570 kB]
Fetched 1570 kB in 1s (2386 kB/s)       
Selecting previously unselected package libpython3.6:amd64.
(Reading database ... 70730 files and directories currently installed.)
Preparing to unpack .../libpython3.6_3.6.15-1+focal1_amd64.deb ...
Unpacking libpython3.6:amd64 (3.6.15-1+focal1) ...
Setting up libpython3.6:amd64 (3.6.15-1+focal1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bubblewrap distro-info-data fuse gir1.2-packagekitglib-1.0 libappstream4
  libfuse2 liblmdb0 libpackagekit-glib2-18 libpolkit-agent-1-0
  libpolkit-gobject-1-0 libstemmer0d libyaml-0-2 lsb-release packagekit
  policykit-1 python-apt-common python3-apt python3-certifi python3-chardet
  python3-dbus python3-idna python3-requests python3-requests-unixsocket
  python3-six python3-urllib3 xdg-desktop-portal
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  libglib2.0-tests python3-dbusmock python3-gi python3-software-properties
  software-properties-common
0 upgraded, 0 newly installed, 5 to remove and 116 not upgraded.
After this operation, 11.8 MB disk space will be freed.
(Reading database ... 70737 files and directories currently installed.)
Removing libglib2.0-tests (2.64.6-1~ubuntu20.04.4) ...
Removing python3-dbusmock (0.19-1) ...
Removing software-properties-common (0.98.9.5) ...
Removing python3-software-properties (0.98.9.5) ...
Removing python3-gi (3.36.0-1) ...
Processing triggers for dbus (1.12.16-2ubuntu2.1) ...
--2021-12-03 16:33:44--  http://mirrors.edge.kernel.org/ubuntu/pool/main/p/pygobject/python3-gi_3.26.1-2ubuntu1_amd64.deb
Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.197.195, 2604:1380:1:3600::1
Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.197.195|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 153080 (149K) [application/octet-stream]
Saving to: 'python3-gi_3.26.1-2ubuntu1_amd64.deb'

python3-gi_3.26.1-2 100%[===================>] 149.49K  --.-KB/s    in 0.03s   

2021-12-03 16:33:44 (4.73 MB/s) - 'python3-gi_3.26.1-2ubuntu1_amd64.deb' saved [153080/153080]

Selecting previously unselected package python3-gi.
(Reading database ... 69764 files and directories currently installed.)
Preparing to unpack python3-gi_3.26.1-2ubuntu1_amd64.deb ...
Unpacking python3-gi (3.26.1-2ubuntu1) ...
dpkg: dependency problems prevent configuration of python3-gi:
 python3-gi depends on python3 (<< 3.7); however:
  Version of python3 on system is 3.8.2-0ubuntu2.
 python3-gi depends on libffi6 (>= 3.0.4); however:
  Package libffi6 is not installed.
 libgirepository-1.0-1:amd64 (1.64.1-1~ubuntu20.04.1) breaks python3-gi (<< 3.34.0-4~) and is installed.
  Version of python3-gi to be configured is 3.26.1-2ubuntu1.

dpkg: error processing package python3-gi (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3-gi
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python3 (python3) in auto mode
update-alternatives: using /usr/bin/python3.6m to provide /usr/bin/python3 (python3) in auto mode
update-alternatives: using /usr/bin/python3.8 to provide /usr/bin/python3 (python3) in auto mode
There are 3 choices for the alternative python3 (providing /usr/bin/python3).

  Selection    Path                 Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3.8    3         auto mode
  1            /usr/bin/python3.6    1         manual mode
  2            /usr/bin/python3.6m   2         manual mode
  3            /usr/bin/python3.8    3         manual mode

Press <enter> to keep the current choice[*], or type selection number: update-alternatives: using /usr/bin/python3.6m to provide /usr/bin/python3 (python3) in manual mode
Collecting numpy
  Downloading numpy-1.19.5-cp36-cp36m-manylinux2010_x86_64.whl (14.8 MB)
     |################################| 14.8 MB 26.4 MB/s 
Installing collected packages: numpy
Successfully installed numpy-1.19.5
Collecting opencv-python
  Downloading opencv_python-4.5.4.60-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (60.3 MB)
     |################################| 60.3 MB 30.2 MB/s 
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from opencv-python) (1.19.5)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.5.4.60
Removing intermediate container 06c70f3e982e
 ---> eabf215b83f1
Step 3/7 : RUN cd sources &&     git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git
 ---> Running in ac390ea288a0
Cloning into 'deepstream_python_apps'...
remote: Enumerating objects: 424, done.
remote: Counting objects: 100% (252/252), done.
remote: Compressing objects: 100% (133/133), done.
remote: Total 424 (delta 133), reused 215 (delta 114), pack-reused 172
Receiving objects: 100% (424/424), 3.77 MiB | 46.47 MiB/s, done.
Resolving deltas: 100% (228/228), done.
Removing intermediate container ac390ea288a0
 ---> 840be599c402
Step 4/7 : RUN apt install -y python3-gi python3-gst-1.0 python-gi-dev git python3 python3-pip cmake g++ build-essential     libglib2.0-dev python3-dev python3.6-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake
 ---> Running in e7d2869f1324
Reading package lists... Done
Building dependency tree       
Reading state information... Done
autoconf is already the newest version (2.69-11.1).
automake is already the newest version (1:1.16.1-4ubuntu6).
automake set to manually installed.
cmake is already the newest version (3.16.3-1ubuntu1).
g++ is already the newest version (4:9.3.0-1ubuntu2).
g++ set to manually installed.
libtool is already the newest version (2.4.6-14).
m4 is already the newest version (1.4.18-4).
m4 set to manually installed.
python3 is already the newest version (3.8.2-0ubuntu2).
build-essential is already the newest version (12.8ubuntu1.1).
git is already the newest version (1:2.25.1-1ubuntu3.2).
libglib2.0-dev is already the newest version (2.64.6-1~ubuntu20.04.4).
libglib2.0-dev-bin is already the newest version (2.64.6-1~ubuntu20.04.4).
python3-pip is already the newest version (20.0.2-5ubuntu1.6).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 python3-dev : Depends: libpython3-dev (= 3.8.2-0ubuntu2) but it is not going to be installed
               Depends: python3.8-dev (>= 3.8.2-1~) but it is not going to be installed
 python3.6-dev : Depends: libpython3.6-dev (= 3.6.15-1+focal1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
The command '/bin/sh -c apt install -y python3-gi python3-gst-1.0 python-gi-dev git python3 python3-pip cmake g++ build-essential     libglib2.0-dev python3-dev python3.6-dev libglib2.0-dev-bin python-gi-dev libtool m4 autoconf automake' returned a non-zero code: 100

Looking closely at the output, this might be caused by a fail in the first command sh docker_python_setup.sh: looking closer at the output you will see:

dpkg: error processing package python3-gi (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3-gi

Maybe that’s why also the apt install fails. How could I fix this?

After some researches I found out that some of the issue were caused by the use of an headless machine. I still can’t use deepstream triton container because of the errors above, but I can at least start the example in the devel container. Let’s focus on this for now.
After processing the first frame, the app crashes:

root@ip-172-31-9-127:/opt/nvidia/deepstream/deepstream-6.0# 
root@ip-172-31-9-127:/opt/nvidia/deepstream/deepstream-6.0# cd /opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps/deepstream-imagedata-multistream
root@ip-172-31-9-127:/opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps/deepstream-imagedata-multistream# python3 deepstream_imagedata-multistream.py rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov frames
Frames will be saved in  frames

(gst-plugin-scanner:28): GStreamer-WARNING **: 19:11:13.266: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:28): GStreamer-WARNING **: 19:11:13.276: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory
Creating Pipeline 
 
Creating streamux 
 
Creating source_bin  0  
 
Creating source bin
source-bin-00
Creating Pgie 
 
Creating nvvidconv1 
 
Creating filter1 
 
Creating tiler 
 
Creating nvvidconv 
 
Creating nvosd 
 
Creating EGLSink 

Atleast one of the sources is live
Adding elements to Pipeline 

Linking elements in the Pipeline 

Now playing...
1 :  rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
Starting pipeline 

ERROR: ../nvdsinfer/nvdsinfer_model_builder.cpp:1484 Deserialize engine failed because file path: /opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps/deepstream-imagedata-multistream/../../../../samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine open error
0:00:01.266485927    12      0x368b270 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1889> [UID = 1]: deserialize engine from file :/opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps/deepstream-imagedata-multistream/../../../../samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed
0:00:01.266546708    12      0x368b270 WARN                 nvinfer gstnvinfer.cpp:635:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Warning from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:1996> [UID = 1]: deserialize backend context from engine from file :/opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps/deepstream-imagedata-multistream/../../../../samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine failed, try rebuild
0:00:01.266567941    12      0x368b270 INFO                 nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1914> [UID = 1]: Trying to create engine from model files
WARNING: [TRT]: Detected invalid timing cache, setup a local cache instead
0:00:11.720963425    12      0x368b270 INFO                 nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:<primary-inference> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::buildModel() <nvdsinfer_context_impl.cpp:1947> [UID = 1]: serialize cuda engine to file: /opt/nvidia/deepstream/deepstream-6.0/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine successfully
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:11.726100202    12      0x368b270 INFO                 nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:<primary-inference> [UID 1]: Load new model:dstest_imagedata_config.txt sucessfully
Decodebin child added: source 

Decodebin child added: decodebin0 

Decodebin child added: rtph264depay0 

Decodebin child added: h264parse0 

Decodebin child added: capsfilter0 

Decodebin child added: nvv4l2decoder0 

In cb_newpad

Decodebin child added: decodebin1 

Decodebin child added: rtpmp4gdepay0 

Decodebin child added: aacparse0 

Frame Number= 0 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
0:00:12.142796107    12      0x349f630 WARN                 nvinfer gstnvinfer.cpp:2288:gst_nvinfer_output_loop:<primary-inference> error: Internal data stream error.
0:00:12.142827283    12      0x349f630 WARN                 nvinfer gstnvinfer.cpp:2288:gst_nvinfer_output_loop:<primary-inference> error: streaming stopped, reason not-negotiated (-4)
Error: gst-stream-error-quark: Internal data stream error. (1): gstnvinfer.cpp(2288): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:primary-inference:
streaming stopped, reason not-negotiated (-4)
Exiting app

Frame Number= 1 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
Decodebin child added: avdec_aac0 

In cb_newpad

Here’s what I did:
I created a Dockerbuild file:

FROM nvcr.io/nvidia/deepstream:6.0-devel
ENV GIT_SSL_NO_VERIFY=1
#RUN apt install -y python3-pip wget python-gi-dev
# RUN add-apt-repository -y ppa:deadsnakes/ppa && apt update
RUN 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
#RUN apt install -y python3-pip python-gi-dev python3.6-dev libpython3.6-dev python3.8-dev
#RUN apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev wget
#ENV GST_PLUGIN_PATH="/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream:${GST_PLUGIN_PATH}"
#ENV GST_PLUGIN_PATH="/opt/nvidia/deepstream/deepstream-6.0/lib/gst-plugins:${GST_PLUGIN_PATH}"
#ENV LD_LIBRARY="/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream:${LD_LIBRARY}"
#ENV LD_LIBRARY="/opt/nvidia/deepstream/deepstream-6.0/lib/gst-plugins:${LD_LIBRARY}"
#RUN echo '/usr/local/lib/gstreamer-1.0' >> /etc/ld.so.conf
#RUN ldconfig
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources/apps && \
    git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps && \
    git submodule update --init
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps/3rdparty/gst-python/ && \
   ./autogen.sh && \
   make && \
   make install
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps/bindings && \
    mkdir build && \
    cd build && \
    cmake -DPYTHON_MAJOR_VERSION=3 -DPYTHON_MINOR_VERSION=6 -DPIP_PLATFORM=linux_x86_64 -DDS_PATH=/opt/nvidia/deepstream/deepstream-6.0 .. && \
    make && \
    pip3 install pyds-1.1.0-py3-none-linux_x86_64.whl
RUN cd /opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps && \
    mv apps/* ./
RUN pip3 install --upgrade pip
RUN pip3 install numpy opencv-python

Then I built the docker image and run it:

docker build . -t deepstream-custom
sudo docker run -it --rm --net=host --runtime nvidia -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --device /dev/video0 --privileged deepstream-custom

Once inside the container:

cd /opt/nvidia/deepstream/deepstream-6.0/sources/apps/deepstream_python_apps/deepstream-imagedata-multistream
python3 deepstream_imagedata-multistream.py rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov  frames

As you can see the plugins error are still there.
I would like to try the sample inside the deepstream triton container but I can’t because of the error in the post above.