This is something I had stumbled upon since I am using python2 as the default interpreter but the following code (and Deepstream applications) worked ok for me (even though the bindings did not compile for python3 at all).
gi.require_version('Gst', '1.0') # This is fine
from gi.repository import Gst
This is fine, since the necessary packages are already installed with the following command (copied from the same guide).
The question is:
Given that using gstreamer in Python is already enabled by installing gir1.2-gstreamer-1.0, gir1.2-gst-plugins-base-1.0 packages (already installed in the apt script above), is it not necessary to compile gst-python from source?
Is this correct, or am I missing something.
thank you for the reply. Could you please expand more on the following statement? I am not sure I understand correctly what it means.
gst-python is necessary, we need to compile it because there is no at default
To elaborate even more, in the meantime, I have used the docker image nvcr.io/nvidia/deepstream-l4t:6.2-base and compiled pyds from source. I have skipped the gst-python installation step from this tutorial. Afterwards, I have been successful in running deepstream apps in Python without any issue.
Moreover, I have then repeated this procedure but without skipping the gst-python compilation and run a quick test:
With this, i have noticed that Python is not using the compiled version binary, but it prefers the one installed in the section 1.2 of the tutorial via apt-get (although not explicitely listed, there is a dependency on the package python3-gst-1.0).
allow me to expand on each of the three points:
The base docker does not contain Deepstream headers (to save space I presume), but we can easily mount them from the host machine (or in Dockerfile, use the COPY command to add them. I am also mounting samples in order to use the packaged models to run sample applications, but for the compilation alone, it is not necessary.
This is how I started the docker container when I was testing the installation.
I have tested this just now on a Jetson Orin, Jetpack 5.1 without any problem whatsoever.
I have been using mainly our proprietary applications written on top of Deepstream SDK, but for testing purposes, I like to use some of the sample applications. For example deepstream_test_2 is a very nice way to test out inference, tracking, and visualization.
After checking, installing python3-gst-1.0 and gst-python did the similar thing, they all will install /usr/lib/python3/dist-packages/gi/overrides/_gi_gst.cpython-38-aarch64-linux-gnu.so, here are the installing logs: install-python3-gst-1.0.txt (3.7 KB) install-gst-python.txt (8.2 KB)
Both use a different procedure with different ENV vars and library version (one uses gst-python version 1.14.5 and the other 1.16.2). Pehaps this can be potentially confusing for other developers, wanting to compile the dependencies from source.