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 “”, line 38, in
import cv2
ImportError: cannot open shared object file: No such file or directory
If I add just the libavcodec58 installation into my Dockerfile I then receive that 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, the common folder, my own test.mp4 video and Dockerfile. The Dockerfile looks like this:


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 \
    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 \
    && 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/ \
    && ./ \
    && 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

# Start the application
CMD ["python3", "", "test.mp4"]

Maybe I am missing something?

There is a script “” in deepstream:6.2-devel, running “./ -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 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” 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 "", line 353, in <module>
  File "", line 202, in main
  File "/usr/lib/python3/dist-packages/gi/overrides/", 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.