Libpython configuration error

Continuing the discussion from Deepstream-test1: configure: error: Python libs not found Windows requires Python modules to be explicitly linked to libpython. configure failed:

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) : dGPU (Ubuntu20.04)
• DeepStream Version : 6.1
• JetPack Version (valid for Jetson only)
• TensorRT Version : 8.4.1-1
• NVIDIA GPU Driver Version (valid for GPU only): 510.73.08
• Issue Type( questions, new requirements, bugs) : bug
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description) : configuration file of python bindings
• gst version : 1.16.2

Heya! I have some an issue when linking with autogen.sh. I understand that autogen generates configure which then fails because for some reason it cannot find libraries required to embed python. This creates the following error which is exactly what was the issue in the previous post:

configure: error: Python libs not found. Windows requires Python modules to be explicitly linked to libpython.

When trying to pass python as an environment variable (which is python2.7) instead of python3 it works fine, but judging from the requirements of the python bindings we need python3.8.

Taking all the above into consideration the answer in the attached previous blog post is erroneous and I really don’t understand why (1) it has received 3 upvotes and (2) it has been closed as an issue.


Some more debugging info:

$ apt policy python3 python3-dev libpython3-dev

python3:
  Installed: 3.8.2-0ubuntu2
  Candidate: 3.8.2-0ubuntu2
  Version table:
 *** 3.8.2-0ubuntu2 500
        500 http://gr.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
python3-dev:
  Installed: 3.8.2-0ubuntu2
  Candidate: 3.8.2-0ubuntu2
  Version table:
 *** 3.8.2-0ubuntu2 500
        500 http://gr.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
libpython3-dev:
  Installed: 3.8.2-0ubuntu2
  Candidate: 3.8.2-0ubuntu2
  Version table:
 *** 3.8.2-0ubuntu2 500
        500 http://gr.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

Apologies for the almost A2A but the error stems from the fact that GStreamer no longer maintains the autotools build system. They use meson as it can be seen from doing a simple ls after cd gst-python (5th step from the installation guide NVIDIA offers). In detail your instructions say:

$ sudo apt-get install python-gi-dev
$ export GST_LIBS="-lgstreamer-1.0 -lgobject-2.0 -lglib-2.0"
$ export GST_CFLAGS="-pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include"
$ git clone https://github.com/GStreamer/gst-python.git
$ cd gst-python
$ git checkout 5343aeb
$ ./autogen.sh PYTHON=python3
$ ./configure PYTHON=python3
$ make
$ sudo make install

Therefore one can either fix the configure file generated from autogen.sh by changing (LINENO:14466)

PYTHON_LIBS=`$PYTHON-config --ldflags 2>/dev/null`

to

PYTHON_LIBS=`$PYTHON-config --embed --ldflags 2>/dev/null`

This is due to python3.8 new features

OR

Do everything up until and including Step 6 of the Prereq instructions and then:

apt install meson
mkdir meson_build_dir
meson meson_build_dir
ninja -C /meson_build_dir

Which might also lead to some errors


Which method do you recommend meson or autotools?

Which is your default python version?
How about diretly run ./autogen.sh, without specify PYTHON

@amycao Default python version is 2.7.18, if I don’t specify PYTHON3 as an env variable in autogen it’ll automatically use Python 2.7.18 as expected.

If Python 3.8 was used by default this post would not exist.

I noticed you have two different guides 1 2 on how to install those bindings. The latter works seamlessly without autotools issues (since it’s using cmake) nor pyds issues

Is there any particular reason why those two guides are so different?

We noticed the document difference you mentioned, we will investigate and fix it. thanks for your reporting.

We will fix the documentation in Python Sample Apps and Bindings Source Details — DeepStream 6.1.1 Release documentation