Python version mismatch
mjavadhpour opened this issue · comments
I trying to install pgml
extension using jammy
apt package on postgres docker image. This image is based on Debian 12 (bookworm)
. the pgml
can not find suitable libpython
. this is the ldd
output:
# In debian bookworm
ldd /usr/lib/postgresql/16/lib/pgml.so
linux-vdso.so.1 (0x00007fff4ffe6000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f667a7ab000)
libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f667a763000)
libpython3.10.so.1.0 => not found
libopenblas.so.0 => /lib/x86_64-linux-gnu/libopenblas.so.0 (0x00007f6678478000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6678458000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6678379000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6678198000)
/lib64/ld-linux-x86-64.so.2 (0x00007f667b541000)
libgfortran.so.5 => /lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007f6677ece000)
libquadmath.so.0 => /lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f6677e87000)
# In ubuntu jammy
ldd /usr/lib/postgresql/16/lib/pgml.so
linux-vdso.so.1 (0x00007ffe65f21000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fca9abc5000)
libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007fca9ab7b000)
libpython3.10.so.1.0 => /lib/x86_64-linux-gnu/libpython3.10.so.1.0 (0x00007fca9a5a4000)
libopenblas.so.0 => /lib/x86_64-linux-gnu/libopenblas.so.0 (0x00007fca98150000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fca98130000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fca98049000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fca97e21000)
/lib64/ld-linux-x86-64.so.2 (0x00007fca9b96d000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fca97df0000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fca97dd4000)
libgfortran.so.5 => /lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007fca97af9000)
libquadmath.so.0 => /lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007fca97ab1000)
The libpython
installed by the package in debian
:
ls /lib/x86_64-linux-gnu | grep python
libpython3.11.a
libpython3.11.so
libpython3.11.so.1
libpython3.11.so.1.0
I'm not sure if it is a problem with the apt package. in debian
python 3.10 wasn't officially packaged/supported.
The hacky solution is to creating a symbolic link to python 3.11.
ln -s /lib/x86_64-linux-gnu/libpython3.11.so.1.0 /lib/x86_64-linux-gnu/libpython3.10.so.1.0
My guess is that we need python3.11-dev as another ubuntu dependency, along w/ python3.10-dev. cc @levkk
My guess is that we need python3.11-dev as another ubuntu dependency, along w/ python3.10-dev. cc @levkk
As far as I see in the source code the extension always looking for lib python 3.10 to access required headers, Is there anyway to change it to 3.11?!
Anyway after symbolic linking the shared object, the extension work fine (at least at create extension pgml;
) and detect the actual python version (3.11).
This image is based on Debian 12 (bookworm)
Jammy packages only work on Jammy (Ubuntu 22.04), not Debian. For Debian, you'll need to compile from source. Ubuntu 22.04 comes with Python 3.10, that's why the jammy package always looks for Python 3.10 and why we need to build and distribute separate apt packages for each apt-based distro and distro version.
I know and it's good, I understand that the way that I trying to use the apt package is not standard. If it is not possible to dynamically looking for the python library (based on the installed version), so this issue would be closed.