# Libpython configuration error

**URL:** <https://forums.developer.nvidia.com/t/libpython-configuration-error/218120>\
**Category:** DeepStream SDK\
**Tags:** nvbugs, python, deepstream\
**Created:** [June 19, 2022, 10:47am UTC](https://forums.developer.nvidia.com/t/libpython-configuration-error/218120 "2022-06-19T10:47:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lemonsqueeze](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/lemonsqueeze/32/67362_2.png) [@lemonsqueeze](https://forums.developer.nvidia.com/u/lemonsqueeze)\
**Post date:** [June 19, 2022, 10:47am UTC](https://forums.developer.nvidia.com/t/libpython-configuration-error/218120/1 "2022-06-19T10:47:15Z")

</div>

Continuing the discussion from [Deepstream-test1: configure: error: Python libs not found Windows requires Python modules to be explicitly linked to libpython. configure failed](https://forums.developer.nvidia.com/t/deepstream-test1-configure-error-python-libs-not-found-windows-requires-python-modules-to-be-explicitly-linked-to-libpython-configure-failed/127731/9):

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:

```auto
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](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Python_Sample_Apps.html#python-bindings-and-application-development) 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:

```auto
$ 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

```

---

<div class="post-metadata">

**Author:** ![lemonsqueeze](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/lemonsqueeze/32/67362_2.png) [@lemonsqueeze](https://forums.developer.nvidia.com/u/lemonsqueeze)\
**Post date:** [June 19, 2022, 6:13pm UTC](https://forums.developer.nvidia.com/t/libpython-configuration-error/218120/3 "2022-06-19T18:13:19Z")

</div>

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](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Python_Sample_Apps.html#python-bindings-and-application-development) NVIDIA offers). In detail your instructions say:

```auto
$ 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)_

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

```

**to**

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

```

> This is due to `python3.8` [new features](https://docs.python.org/3/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build)

_OR_

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

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

```

Which might also lead to some [errors](https://gitlab.freedesktop.org/gstreamer/gst-python/-/issues/28)…

* * *

**Which method do you recommend meson or autotools?**

---

<div class="post-metadata">

**Author:** ![Amycao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/amycao/32/11342_2.png) [@Amycao](https://forums.developer.nvidia.com/u/Amycao)\
**Post date:** [June 20, 2022, 4:12am UTC](https://forums.developer.nvidia.com/t/libpython-configuration-error/218120/4 "2022-06-20T04:12:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lemonsqueeze](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/lemonsqueeze/32/67362_2.png) [@lemonsqueeze](https://forums.developer.nvidia.com/u/lemonsqueeze)\
**Post date:** [June 20, 2022, 10:22am UTC](https://forums.developer.nvidia.com/t/libpython-configuration-error/218120/5 "2022-06-20T10:22:13Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![lemonsqueeze](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/lemonsqueeze/32/67362_2.png) [@lemonsqueeze](https://forums.developer.nvidia.com/u/lemonsqueeze)\
**Post date:** [June 20, 2022, 3:02pm UTC](https://forums.developer.nvidia.com/t/libpython-configuration-error/218120/6 "2022-06-20T15:02:47Z")

</div>

I noticed you have two different guides [1](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Python_Sample_Apps.html#prerequisites) [**2**](https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/tree/master/bindings#deepstream-python-bindings) on how to install those bindings. **The latter works seamlessly** without autotools issues (since it’s using cmake) nor [`pyds` issues](https://forums.developer.nvidia.com/t/no-module-named-pyds/123722)

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

---

<div class="post-metadata">

**Author:** ![Amycao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/amycao/32/11342_2.png) [@Amycao](https://forums.developer.nvidia.com/u/Amycao)\
**Post date:** [June 21, 2022, 3:52am UTC](https://forums.developer.nvidia.com/t/libpython-configuration-error/218120/7 "2022-06-21T03:52:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Amycao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/amycao/32/11342_2.png) [@Amycao](https://forums.developer.nvidia.com/u/Amycao)\
**Post date:** [June 23, 2022, 4:12am UTC](https://forums.developer.nvidia.com/t/libpython-configuration-error/218120/8 "2022-06-23T04:12:00Z")

</div>

We will fix the documentation in [Python Sample Apps and Bindings Source Details — DeepStream 6.1.1 Release documentation](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Python_Sample_Apps.html#prerequisites)
