Problem setting up Deepstream 6.2 Python docker image

I am trying to build Dockerfile for Deepstream 6.2 with Python and for starters to run a sample app with my own video.

• Hardware Platform (Jetson / GPU) - GPU
• DeepStream Version - Deepstream 6.2
• Issue Type( questions, new requirements, bugs) After building the Dockerfile and trying to run the docker image I get an error that when trying to import cv2:
File “deepstream_imagedata-multistream.py”, line 38, in
import cv2
ImportError: libavcodec.so.58: cannot open shared object file: No such file or directory
If I add just the libavcodec58 installation into my Dockerfile I then receive that libavutil.so.56 is missing and so on. Below in my Dockerfile you can see all the installations I tried, but the missing files kept occurring and I don’t think that’s how it should be. At first I had problem with Python bindings, but I found someone’s else Dockerfile with Python bindings compilation and it seems to work.

• How to reproduce the issue ? I created a project folder with /NVIDIA-AI-IOT/deepstream_python_apps some repo files. Like deepstream_imagedata_multistream.py, the common folder, my own test.mp4 video and Dockerfile. The Dockerfile looks like this:

FROM nvcr.io/nvidia/deepstream:6.2-devel

RUN apt-get update -y
RUN apt-get install cmake -y

RUN apt-get update && apt-get install -y \
    python3-gi python3-dev python3-gst-1.0 \
    python3-opencv python3-numpy python3-pip\
    libgstreamer1.0-0 \
    gstreamer1.0-tools \
    gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-bad \
    gstreamer1.0-plugins-ugly \
    gstreamer1.0-libav \
    libjansson4 \
    libavcodec-dev libavformat-dev libswscale-dev \
    libgstreamer-plugins-base1.0-dev \
    libgstreamer1.0-dev \
    json-glib-1.0 \
    libjson-glib-dev\
    libgstrtspserver-1.0-0 gstreamer1.0-rtsp \
    libgirepository1.0-dev \
    gobject-introspection \
    gir1.2-gst-rtsp-server-1.0 \
    libgtk-3-dev \
    && apt install libavcodec58 libavutil56 libvpx6 libx264-dev --reinstall
    
# Compile Python bindings
RUN 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 -y
RUN cd /opt/nvidia/deepstream/deepstream/sources/ \
    && git clone https://github.com/NVIDIA-AI-IOT/deepstream_python_apps.git \
    && cd deepstream_python_apps \
    && git submodule update --init \
    && apt-get install -y apt-transport-https ca-certificates -y \
    && update-ca-certificates \
    && cd 3rdparty/gst-python/ \
    && ./autogen.sh \
    && make \
    && make install \
    && cd ../../bindings \
    && mkdir build \
    && cd build \
    && cmake .. \
    && make \
    && pip3 install ./pyds-*.whl  

WORKDIR /opt/nvidia/deepstream/deepstream-6.2/app/
COPY . .

# Set environment variable
ENV PYTHONPATH=/opt/nvidia/deepstream/deepstream-6.2/sources/:$PYTHONPATH

# Expose port for RTSP streaming
EXPOSE 8554

# Start the application
CMD ["python3", "deepstream_imagedata-multistream.py", "test.mp4"]

Maybe I am missing something?

There is a script “user_deepstream_python_apps_install.sh” in deepstream:6.2-devel, running “./user_deepstream_python_apps_install.sh -v 1.1.6” can setup Python environment for deepstream_python_apps, can you try this approach?
This script can be downloaded from release Releases · NVIDIA-AI-IOT/deepstream_python_apps · GitHub

Thank you, the script did solve the missing dependencies and files problem.
I have another question, do I need to install Nvidia CUDA toolkit in the Dockerfile since I am getting libcuda.so.1 errors. I am very new to this, so some thing are not always clear.

Cuda toolkit is installed in the docker, you can use command “dpkg -S libcuda.so” to find which package owns the library.

Trying to run sample app “deepstream-imagedata-multistream” and I am getting errors:

Creating streamux 
 
 Unable to create NvStreamMux 
Traceback (most recent call last):
  File "main.py", line 353, in <module>
    sys.exit(main())
  File "main.py", line 202, in main
    pipeline.add(streammux)
  File "/usr/lib/python3/dist-packages/gi/overrides/Gst.py", line 64, in add
    if not Gst.Bin.add(self, arg):
TypeError: Argument 1 does not allow None as a value

Any ideas where to look for a problem, since I am following the rules how to run the sample app but still running into problems.

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

How about running sample deepstream-test1? it is the most simple sample and you can use it to check your environment.

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