Python version '3.9' doesn't exist - Library not found

Hi,

I’m having issues getting the Python middleware to work since we switched distros. We’re on Debian Buster now and I’ve followed Python for packages I need to install.

The error we’re getting is this:

time="Dec 08 23:47:16" level=error msg="Python version '3.9' doesn't exist" error="Library not found"
time="Dec 08 23:47:16" level=error msg="Couldn't load Python dispatcher" error="python version '3.9' doesn't exist" prefix=coprocess

The first “Library not found” one is coming from tyk/main.go at master · TykTechnologies/tyk · GitHub. I tried to figure out what library it’s trying to use.

root@cdc95bbc6daf:/opt/tyk-gateway# python-config --ldflags
 -L/usr/local/lib  -lcrypt -lpthread -ldl  -lutil -lm -lm

It seems like Tyk is looking for a -l flag with python in the name according to this which the output of python-config --ldflags doesn’t contain. So presumably it falls back to lib.so according to this line.

These are the libs I have in my /usr/local/lib folder:

root@cdc95bbc6daf:/opt/tyk-gateway# ls -las /usr/local/lib
total 3784
   8 drwxr-xr-x 1 root root     4096 Dec  8 23:20 .
   8 drwxr-xr-x 1 root root     4096 Nov 17  2020 ..
   0 lrwxrwxrwx 1 root root       19 Nov 25  2020 libpython3.9.so -> libpython3.9.so.1.0
3736 -rwxr-xr-x 1 root root  3821832 Nov 25  2020 libpython3.9.so.1.0
  16 -rwxr-xr-x 1 root root    14016 Nov 25  2020 libpython3.so
   4 drwxr-xr-x 2 root root     4096 Nov 25  2020 pkgconfig
   4 drwxrwsr-x 3 root staff    4096 Dec  8 23:20 python3.7
   8 drwxr-xr-x 1 root root     4096 Nov 25  2020 python3.9

We’re using Python 3.9

root@a9358d49c293:/opt/tyk-gateway# python -V
Python 3.9.0

These are the packages I have installed:

root@28ec249d73fd:/opt/tyk-gateway# apt list --installed
Listing... Done
adduser/oldstable,now 3.118 all [installed,automatic]
apt-transport-https/oldstable,oldstable-updates,now 1.8.2.3 all [installed]
apt/oldstable,oldstable-updates,now 1.8.2.3 amd64 [installed,automatic]
base-files/oldstable,now 10.3+deb10u11 amd64 [installed,automatic]
base-passwd/oldstable,now 3.5.46 amd64 [installed,automatic]
bash/oldstable,now 5.0-4 amd64 [installed,automatic]
binutils-common/oldstable,now 2.31.1-16 amd64 [installed,automatic]
binutils-x86-64-linux-gnu/oldstable,now 2.31.1-16 amd64 [installed,automatic]
binutils/oldstable,now 2.31.1-16 amd64 [installed,automatic]
bsdutils/oldstable,now 1:2.33.1-0.1 amd64 [installed,automatic]
build-essential/oldstable,now 12.6 amd64 [installed]
bzip2/oldstable,now 1.0.6-9.2~deb10u1 amd64 [installed,automatic]
ca-certificates/oldstable,oldstable-updates,now 20200601~deb10u2 all [installed]
chrony/oldstable,now 3.4-4+deb10u1 amd64 [installed]
coreutils/oldstable,now 8.30-3 amd64 [installed,automatic]
cpp-8/oldstable,now 8.3.0-6 amd64 [installed,automatic]
cpp/oldstable,now 4:8.3.0-1 amd64 [installed,automatic]
cracklib-runtime/oldstable,now 2.9.6-2 amd64 [installed,automatic]
curl/oldstable,oldstable,now 7.64.0-4+deb10u2 amd64 [installed]
dash/oldstable,now 0.5.10.2-5 amd64 [installed,automatic]
dbus/oldstable,now 1.12.20-0+deb10u1 amd64 [installed,automatic]
debconf/oldstable,now 1.5.71+deb10u1 all [installed,automatic]
debian-archive-keyring/oldstable,now 2019.1+deb10u1 all [installed]
debianutils/oldstable,now 4.8.6.1 amd64 [installed,automatic]
dh-python/oldstable,now 3.20190308 all [installed,automatic]
diffutils/oldstable,now 1:3.7-3 amd64 [installed,automatic]
dirmngr/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
dmsetup/oldstable,now 2:1.02.155-3 amd64 [installed,automatic]
dpkg-dev/oldstable,now 1.19.7 all [installed,automatic]
dpkg/oldstable,now 1.19.7 amd64 [installed,automatic]
e2fsprogs/oldstable,now 1.44.5-1+deb10u3 amd64 [installed,automatic]
fakeroot/oldstable,now 1.23-1 amd64 [installed,automatic]
fdisk/oldstable,now 2.33.1-0.1 amd64 [installed,automatic]
file/oldstable,now 1:5.35-4+deb10u2 amd64 [installed,automatic]
findutils/oldstable,now 4.6.0+git+20190209-2 amd64 [installed,automatic]
g++-8/oldstable,now 8.3.0-6 amd64 [installed,automatic]
g++/oldstable,now 4:8.3.0-1 amd64 [installed,automatic]
gcc-8-base/oldstable,now 8.3.0-6 amd64 [installed,automatic]
gcc-8/oldstable,now 8.3.0-6 amd64 [installed,automatic]
gcc/oldstable,now 4:8.3.0-1 amd64 [installed]
gnupg-l10n/oldstable,now 2.2.12-1+deb10u1 all [installed,automatic]
gnupg-utils/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
gnupg/oldstable,now 2.2.12-1+deb10u1 all [installed]
gpg-agent/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
gpg-wks-client/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
gpg-wks-server/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
gpg/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
gpgconf/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
gpgsm/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
gpgv/oldstable,now 2.2.12-1+deb10u1 amd64 [installed,automatic]
grep/oldstable,now 3.3-1 amd64 [installed,automatic]
gzip/oldstable,now 1.9-3 amd64 [installed,automatic]
hostname/oldstable,now 3.21 amd64 [installed,automatic]
icu-devtools/oldstable,now 63.1-6+deb10u2 amd64 [installed,automatic]
init-system-helpers/oldstable,now 1.56+nmu1 all [installed,automatic]
iproute2/oldstable,now 4.20.0-2+deb10u1 amd64 [installed,automatic]
krb5-locales/oldstable,now 1.17-3+deb10u3 all [installed,automatic]
libacl1/oldstable,now 2.2.53-4 amd64 [installed,automatic]
libalgorithm-diff-perl/oldstable,now 1.19.03-2 all [installed,automatic]
libalgorithm-diff-xs-perl/oldstable,now 0.04-5+b1 amd64 [installed,automatic]
libalgorithm-merge-perl/oldstable,now 0.08-3 all [installed,automatic]
libapparmor1/oldstable,now 2.13.2-10 amd64 [installed,automatic]
libapt-pkg5.0/oldstable,oldstable-updates,now 1.8.2.3 amd64 [installed,automatic]
libargon2-1/oldstable,now 0~20171227-0.2 amd64 [installed,automatic]
libasan5/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libassuan0/oldstable,now 2.5.2-1 amd64 [installed,automatic]
libatm1/oldstable,now 1:2.5.1-2 amd64 [installed,automatic]
libatomic1/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libattr1/oldstable,now 1:2.4.48-4 amd64 [installed,automatic]
libaudit-common/oldstable,now 1:2.8.4-3 all [installed,automatic]
libaudit1/oldstable,now 1:2.8.4-3 amd64 [installed,automatic]
libbinutils/oldstable,now 2.31.1-16 amd64 [installed,automatic]
libblkid1/oldstable,now 2.33.1-0.1 amd64 [installed,automatic]
libbsd0/oldstable,now 0.9.1-2+deb10u1 amd64 [installed,automatic]
libbz2-1.0/oldstable,now 1.0.6-9.2~deb10u1 amd64 [installed]
libc-bin/oldstable,now 2.28-10 amd64 [installed,automatic]
libc-dev-bin/oldstable,now 2.28-10 amd64 [installed,automatic]
libc6-dev/oldstable,now 2.28-10 amd64 [installed,automatic]
libc6/oldstable,now 2.28-10 amd64 [installed]
libcap-ng0/oldstable,now 0.7.9-2 amd64 [installed,automatic]
libcap2-bin/oldstable,now 1:2.25-2 amd64 [installed,automatic]
libcap2/oldstable,now 1:2.25-2 amd64 [installed,automatic]
libcc1-0/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libcom-err2/oldstable,now 1.44.5-1+deb10u3 amd64 [installed,automatic]
libcrack2/oldstable,now 2.9.6-2 amd64 [installed,automatic]
libcryptsetup12/oldstable,now 2:2.1.0-5+deb10u2 amd64 [installed,automatic]
libcurl4/oldstable,oldstable,now 7.64.0-4+deb10u2 amd64 [installed,automatic]
libdb5.3/oldstable,now 5.3.28+dfsg1-0.5 amd64 [installed,automatic]
libdbus-1-3/oldstable,now 1.12.20-0+deb10u1 amd64 [installed,automatic]
libdebconfclient0/oldstable,now 0.249 amd64 [installed,automatic]
libdevmapper1.02.1/oldstable,now 2:1.02.155-3 amd64 [installed,automatic]
libdpkg-perl/oldstable,now 1.19.7 all [installed,automatic]
libedit2/oldstable,now 3.1-20181209-1 amd64 [installed,automatic]
libelf1/oldstable,now 0.176-1.1 amd64 [installed,automatic]
libevent-2.1-6/oldstable,now 2.1.8-stable-4 amd64 [installed,automatic]
libexpat1-dev/oldstable,oldstable,now 2.2.6-2+deb10u1 amd64 [installed,automatic]
libexpat1/oldstable,oldstable,now 2.2.6-2+deb10u1 amd64 [installed]
libext2fs2/oldstable,now 1.44.5-1+deb10u3 amd64 [installed,automatic]
libfakeroot/oldstable,now 1.23-1 amd64 [installed,automatic]
libfdisk1/oldstable,now 2.33.1-0.1 amd64 [installed,automatic]
libffi6/oldstable,now 3.2.1-9 amd64 [installed]
libfile-fcntllock-perl/oldstable,now 0.22-3+b5 amd64 [installed,automatic]
libgcc-8-dev/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libgcc1/oldstable,now 1:8.3.0-6 amd64 [installed,automatic]
libgcrypt20-dev/oldstable,now 1.8.4-5+deb10u1 amd64 [installed,automatic]
libgcrypt20/oldstable,now 1.8.4-5+deb10u1 amd64 [installed,automatic]
libgdbm-compat4/oldstable,now 1.18.1-4 amd64 [installed,automatic]
libgdbm6/oldstable,now 1.18.1-4 amd64 [installed]
libglib2.0-0/oldstable,now 2.58.3-2+deb10u3 amd64 [installed,automatic]
libglib2.0-data/oldstable,now 2.58.3-2+deb10u3 all [installed,automatic]
libgmp-dev/oldstable,now 2:6.1.2+dfsg-4 amd64 [installed,automatic]
libgmp10/oldstable,now 2:6.1.2+dfsg-4 amd64 [installed,automatic]
libgmpxx4ldbl/oldstable,now 2:6.1.2+dfsg-4 amd64 [installed,automatic]
libgnutls-dane0/oldstable,now 3.6.7-4+deb10u7 amd64 [installed,automatic]
libgnutls-openssl27/oldstable,now 3.6.7-4+deb10u7 amd64 [installed,automatic]
libgnutls28-dev/oldstable,now 3.6.7-4+deb10u7 amd64 [installed,automatic]
libgnutls30/oldstable,now 3.6.7-4+deb10u7 amd64 [installed,automatic]
libgnutlsxx28/oldstable,now 3.6.7-4+deb10u7 amd64 [installed,automatic]
libgomp1/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libgpg-error-dev/oldstable,now 1.35-1 amd64 [installed,automatic]
libgpg-error0/oldstable,now 1.35-1 amd64 [installed,automatic]
libgpm2/oldstable,now 1.20.7-5 amd64 [installed,automatic]
libgssapi-krb5-2/oldstable,now 1.17-3+deb10u3 amd64 [installed,automatic]
libhiredis0.14/oldstable,now 0.14.0-3 amd64 [installed,automatic]
libhogweed4/oldstable,oldstable,now 3.4.1-1+deb10u1 amd64 [installed,automatic]
libicu-dev/oldstable,now 63.1-6+deb10u2 amd64 [installed,automatic]
libicu63/oldstable,now 63.1-6+deb10u2 amd64 [installed,automatic]
libidn11/oldstable,now 1.33-2.2 amd64 [installed,automatic]
libidn2-0/oldstable,oldstable,now 2.0.5-1+deb10u1 amd64 [installed,automatic]
libidn2-dev/oldstable,oldstable,now 2.0.5-1+deb10u1 amd64 [installed,automatic]
libip4tc0/oldstable,now 1.8.2-4 amd64 [installed,automatic]
libisl19/oldstable,now 0.20-2 amd64 [installed,automatic]
libitm1/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libjemalloc2/oldstable,now 5.1.0-3 amd64 [installed,automatic]
libjson-c3/oldstable,oldstable,now 0.12.1+ds-2+deb10u1 amd64 [installed,automatic]
libk5crypto3/oldstable,now 1.17-3+deb10u3 amd64 [installed,automatic]
libkeyutils1/oldstable,now 1.6-6 amd64 [installed,automatic]
libkmod2/oldstable,now 26-1 amd64 [installed,automatic]
libkrb5-3/oldstable,now 1.17-3+deb10u3 amd64 [installed,automatic]
libkrb5support0/oldstable,now 1.17-3+deb10u3 amd64 [installed,automatic]
libksba8/oldstable,now 1.3.5-2 amd64 [installed,automatic]
libldap-2.4-2/oldstable,oldstable,now 2.4.47+dfsg-3+deb10u6 amd64 [installed,automatic]
libldap-common/oldstable,oldstable,now 2.4.47+dfsg-3+deb10u6 all [installed,automatic]
liblocale-gettext-perl/oldstable,now 1.07-3+b4 amd64 [installed,automatic]
liblsan0/oldstable,now 8.3.0-6 amd64 [installed,automatic]
liblua5.1-0/oldstable,now 5.1.5-8.1+b2 amd64 [installed,automatic]
liblz4-1/oldstable,oldstable,now 1.8.3-1+deb10u1 amd64 [installed,automatic]
liblzma5/oldstable,now 5.2.4-1 amd64 [installed]
libmagic-mgc/oldstable,now 1:5.35-4+deb10u2 amd64 [installed,automatic]
libmagic1/oldstable,now 1:5.35-4+deb10u2 amd64 [installed,automatic]
libmnl0/oldstable,now 1.0.4-2 amd64 [installed,automatic]
libmount1/oldstable,now 2.33.1-0.1 amd64 [installed,automatic]
libmpc3/oldstable,now 1.1.0-1 amd64 [installed,automatic]
libmpdec2/oldstable,now 2.4.2-2 amd64 [installed,automatic]
libmpfr6/oldstable,now 4.0.2-1 amd64 [installed,automatic]
libmpx2/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libncurses6/oldstable,now 6.1+20181013-2+deb10u2 amd64 [installed,automatic]
libncursesw6/oldstable,now 6.1+20181013-2+deb10u2 amd64 [installed]
libnettle6/oldstable,oldstable,now 3.4.1-1+deb10u1 amd64 [installed,automatic]
libnghttp2-14/oldstable,oldstable,now 1.36.0-2+deb10u1 amd64 [installed,automatic]
libnpth0/oldstable,now 1.6-1 amd64 [installed,automatic]
libnspr4-dev/oldstable,now 2:4.20-1 amd64 [installed,automatic]
libnspr4/oldstable,now 2:4.20-1 amd64 [installed,automatic]
libnss-systemd/oldstable,oldstable,now 241-7~deb10u8 amd64 [installed,automatic]
libnss3-dev/oldstable,now 2:3.42.1-1+deb10u4 amd64 [installed,automatic]
libnss3/oldstable,now 2:3.42.1-1+deb10u4 amd64 [installed,automatic]
libp11-kit-dev/oldstable,oldstable,now 0.23.15-2+deb10u1 amd64 [installed,automatic]
libp11-kit0/oldstable,oldstable,now 0.23.15-2+deb10u1 amd64 [installed,automatic]
libpam-cap/oldstable,now 1:2.25-2 amd64 [installed,automatic]
libpam-modules-bin/oldstable,now 1.3.1-5 amd64 [installed,automatic]
libpam-modules/oldstable,now 1.3.1-5 amd64 [installed,automatic]
libpam-pwquality/oldstable,now 1.4.0-3 amd64 [installed]
libpam-runtime/oldstable,now 1.3.1-5 all [installed,automatic]
libpam-systemd/oldstable,oldstable,now 241-7~deb10u8 amd64 [installed,automatic]
libpam0g/oldstable,now 1.3.1-5 amd64 [installed,automatic]
libpcre3/oldstable,now 2:8.39-12 amd64 [installed,automatic]
libperl5.28/oldstable,now 5.28.1-6+deb10u1 amd64 [installed,automatic]
libprocps7/oldstable,now 2:3.3.15-2 amd64 [installed,automatic]
libpsl5/oldstable,now 0.20.2-2 amd64 [installed,automatic]
libpwquality-common/oldstable,now 1.4.0-3 all [installed,automatic]
libpwquality1/oldstable,now 1.4.0-3 amd64 [installed,automatic]
libpython3-dev/oldstable,now 3.7.3-1 amd64 [installed]
libpython3-stdlib/oldstable,now 3.7.3-1 amd64 [installed,automatic]
libpython3.7-dev/oldstable,now 3.7.3-2+deb10u3 amd64 [installed,automatic]
libpython3.7-minimal/oldstable,now 3.7.3-2+deb10u3 amd64 [installed,automatic]
libpython3.7-stdlib/oldstable,now 3.7.3-2+deb10u3 amd64 [installed,automatic]
libpython3.7/oldstable,now 3.7.3-2+deb10u3 amd64 [installed,automatic]
libquadmath0/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libreadline7/oldstable,now 7.0-5 amd64 [installed]
librtmp1/oldstable,now 2.4+20151223.gitfa8646d.1-2 amd64 [installed,automatic]
libsasl2-2/oldstable,oldstable,now 2.1.27+dfsg-1+deb10u1 amd64 [installed,automatic]
libsasl2-modules-db/oldstable,oldstable,now 2.1.27+dfsg-1+deb10u1 amd64 [installed,automatic]
libsasl2-modules/oldstable,oldstable,now 2.1.27+dfsg-1+deb10u1 amd64 [installed,automatic]
libseccomp2/oldstable,now 2.3.3-4 amd64 [installed,automatic]
libselinux1/oldstable,now 2.8-1+b1 amd64 [installed,automatic]
libsemanage-common/oldstable,now 2.8-2 all [installed,automatic]
libsemanage1/oldstable,now 2.8-2 amd64 [installed,automatic]
libsepol1/oldstable,now 2.8-1 amd64 [installed,automatic]
libsmartcols1/oldstable,now 2.33.1-0.1 amd64 [installed,automatic]
libsqlite3-0/oldstable,now 3.27.2-3+deb10u1 amd64 [installed]
libss2/oldstable,now 1.44.5-1+deb10u3 amd64 [installed,automatic]
libssh2-1/oldstable,now 1.8.0-2.1 amd64 [installed,automatic]
libssl-dev/oldstable,oldstable,now 1.1.1d-0+deb10u7 amd64 [installed,automatic]
libssl1.1/oldstable,oldstable,now 1.1.1d-0+deb10u7 amd64 [installed]
libstdc++-8-dev/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libstdc++6/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libsystemd0/oldstable,oldstable,now 241-7~deb10u8 amd64 [installed,automatic]
libtasn1-6-dev/oldstable,now 4.13-3 amd64 [installed,automatic]
libtasn1-6/oldstable,now 4.13-3 amd64 [installed,automatic]
libtasn1-doc/oldstable,now 4.13-3 all [installed,automatic]
libtinfo6/oldstable,now 6.1+20181013-2+deb10u2 amd64 [installed]
libtsan0/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libubsan1/oldstable,now 8.3.0-6 amd64 [installed,automatic]
libudev1/oldstable,oldstable,now 241-7~deb10u8 amd64 [installed,automatic]
libunbound8/oldstable,oldstable,now 1.9.0-2+deb10u2 amd64 [installed,automatic]
libunistring2/oldstable,now 0.9.10-1 amd64 [installed,automatic]
libuuid1/oldstable,now 2.33.1-0.1 amd64 [installed]
libwrap0/oldstable,now 7.6.q-28 amd64 [installed,automatic]
libx11-6/oldstable,oldstable,now 2:1.6.7-1+deb10u2 amd64 [installed,automatic]
libx11-data/oldstable,oldstable,now 2:1.6.7-1+deb10u2 all [installed,automatic]
libxau6/oldstable,now 1:1.0.8-1+b2 amd64 [installed,automatic]
libxcb1/oldstable,now 1.13.1-2 amd64 [installed,automatic]
libxdmcp6/oldstable,now 1:1.1.2-3 amd64 [installed,automatic]
libxext6/oldstable,now 2:1.3.3-1+b2 amd64 [installed,automatic]
libxml2-dev/oldstable,now 2.9.4+dfsg1-7+deb10u2 amd64 [installed]
libxml2/oldstable,now 2.9.4+dfsg1-7+deb10u2 amd64 [installed,automatic]
libxmlsec1-dev/oldstable,now 1.2.27-2 amd64 [installed]
libxmlsec1-gcrypt/oldstable,now 1.2.27-2 amd64 [installed,automatic]
libxmlsec1-gnutls/oldstable,now 1.2.27-2 amd64 [installed,automatic]
libxmlsec1-nss/oldstable,now 1.2.27-2 amd64 [installed,automatic]
libxmlsec1-openssl/oldstable,now 1.2.27-2 amd64 [installed]
libxmlsec1/oldstable,now 1.2.27-2 amd64 [installed,automatic]
libxmuu1/oldstable,now 2:1.1.2-2+b3 amd64 [installed,automatic]
libxslt1-dev/oldstable,now 1.1.32-2.2~deb10u1 amd64 [installed,automatic]
libxslt1.1/oldstable,now 1.1.32-2.2~deb10u1 amd64 [installed,automatic]
libxtables12/oldstable,now 1.8.2-4 amd64 [installed,automatic]
libzstd1/oldstable,oldstable,now 1.3.8+dfsg-3+deb10u2 amd64 [installed,automatic]
linux-libc-dev/oldstable,now 4.19.208-1 amd64 [installed,automatic]
login/oldstable,now 1:4.5-1.1 amd64 [installed,automatic]
lsb-base/oldstable,now 10.2019051400 all [installed,automatic]
lua-bitop/oldstable,now 1.0.2-5 amd64 [installed,automatic]
lua-cjson/oldstable,now 2.1.0+dfsg-2.1 amd64 [installed,automatic]
make/oldstable,now 4.2.1-1.2 amd64 [installed,automatic]
manpages-dev/oldstable,now 4.16-2 all [installed,automatic]
manpages/oldstable,now 4.16-2 all [installed,automatic]
mawk/oldstable,now 1.3.3-17+b3 amd64 [installed,automatic]
mime-support/oldstable,now 3.62 all [installed,automatic]
mount/oldstable,now 2.33.1-0.1 amd64 [installed,automatic]
ncurses-base/oldstable,now 6.1+20181013-2+deb10u2 all [installed,automatic]
ncurses-bin/oldstable,now 6.1+20181013-2+deb10u2 amd64 [installed,automatic]
ncurses-term/oldstable,now 6.1+20181013-2+deb10u2 all [installed,automatic]
netbase/oldstable,now 5.6 all [installed]
nettle-dev/oldstable,oldstable,now 3.4.1-1+deb10u1 amd64 [installed,automatic]
openssh-client/oldstable,now 1:7.9p1-10+deb10u2 amd64 [installed,automatic]
openssh-server/oldstable,now 1:7.9p1-10+deb10u2 amd64 [installed]
openssh-sftp-server/oldstable,now 1:7.9p1-10+deb10u2 amd64 [installed,automatic]
openssl/oldstable,oldstable,now 1.1.1d-0+deb10u7 amd64 [installed,automatic]
passwd/oldstable,now 1:4.5-1.1 amd64 [installed,automatic]
patch/oldstable,oldstable,now 2.7.6-3+deb10u1 amd64 [installed,automatic]
perl-base/oldstable,now 5.28.1-6+deb10u1 amd64 [installed,automatic]
perl-modules-5.28/oldstable,now 5.28.1-6+deb10u1 all [installed,automatic]
perl/oldstable,now 5.28.1-6+deb10u1 amd64 [installed,automatic]
pinentry-curses/oldstable,now 1.1.0-2 amd64 [installed,automatic]
pkg-config/oldstable,now 0.29-6 amd64 [installed]
procps/oldstable,now 2:3.3.15-2 amd64 [installed,automatic]
psmisc/oldstable,now 23.2-1+deb10u1 amd64 [installed,automatic]
publicsuffix/oldstable,now 20190415.1030-1 all [installed,automatic]
python3-dev/oldstable,now 3.7.3-1 amd64 [installed]
python3-distutils/oldstable,now 3.7.3-1 all [installed,automatic]
python3-lib2to3/oldstable,now 3.7.3-1 all [installed,automatic]
python3-minimal/oldstable,now 3.7.3-1 amd64 [installed,automatic]
python3.7-dev/oldstable,now 3.7.3-2+deb10u3 amd64 [installed,automatic]
python3.7-minimal/oldstable,now 3.7.3-2+deb10u3 amd64 [installed,automatic]
python3.7/oldstable,now 3.7.3-2+deb10u3 amd64 [installed,automatic]
python3/oldstable,now 3.7.3-1 amd64 [installed]
readline-common/oldstable,now 7.0-5 all [installed,automatic]
redis-server/oldstable,now 5:5.0.14-1+deb10u1 amd64 [installed]
redis-tools/oldstable,now 5:5.0.14-1+deb10u1 amd64 [installed,automatic]
sed/oldstable,now 4.7-1 amd64 [installed,automatic]
sensible-utils/oldstable,now 0.0.12 all [installed,automatic]
shared-mime-info/oldstable,now 1.10-1 amd64 [installed,automatic]
sudo/oldstable,oldstable,now 1.8.27-1+deb10u3 amd64 [installed]
systemd-sysv/oldstable,oldstable,now 241-7~deb10u8 amd64 [installed,automatic]
systemd/oldstable,oldstable,now 241-7~deb10u8 amd64 [installed,automatic]
sysvinit-utils/oldstable,now 2.93-8 amd64 [installed,automatic]
tar/oldstable,now 1.30+dfsg-6 amd64 [installed,automatic]
tcpd/oldstable,now 7.6.q-28 amd64 [installed]
tyk-gateway/buster,now 3.2.2 amd64 [installed]
tzdata/oldstable-updates,now 2021a-0+deb10u3 all [installed]
ucf/oldstable,now 3.0038+nmu1 all [installed,automatic]
util-linux/oldstable,now 2.33.1-0.1 amd64 [installed,automatic]
wamerican/oldstable,now 2018.04.16-1 all [installed,automatic]
xauth/oldstable,now 1:1.0.10-1 amd64 [installed,automatic]
xdg-user-dirs/oldstable,now 0.17-2 amd64 [installed,automatic]
xz-utils/oldstable,now 5.2.4-1 amd64 [installed,automatic]
zlib1g/oldstable,now 1:1.2.11.dfsg-1 amd64 [installed]

I’m not sure at this point if I’m missing a package/library or if the output of python-config --ldflags is just wrong.

I appreciate your help

Hi,

Could you let us have your tyk.conf please? It would be great to check what settings you’re running with.

Cheers,
Pete

Sure, no problem:

{
  "listen_port": 8080,
  "secret": "...",
  "template_path": "/opt/tyk-gateway/templates",
  "tyk_js_path": "/opt/tyk-gateway/js/tyk.js",
  "middleware_path": "/opt/tyk-gateway/middleware",
  "use_db_app_configs": false,
  "app_path": "/opt/tyk-gateway/apps/",
  "storage": {
    "type": "redis",
    "host": "127.0.0.1",
    "port": 6379,
    "username": "",
    "password": "",
    "database": 0,
    "optimisation_max_idle": 2000,
    "optimisation_max_active": 4000
  },
  "enable_analytics": false,
  "analytics_config": {
    "type": "csv",
    "csv_dir": "/tmp",
    "mongo_url": "",
    "mongo_db_name": "",
    "mongo_collection": "",
    "purge_delay": -1,
    "ignored_ips": []
  },
  "health_check": {
    "enable_health_checks": true,
    "health_check_value_timeouts": 60
  },
  "optimisations_use_async_session_write": true,
  "enable_non_transactional_rate_limiter": true,
  "enable_sentinel_rate_limiter": false,
  "enable_redis_rolling_limiter": false,
  "allow_master_keys": false,
  "policies": {
    "policy_source": "file",
    "policy_record_name": "/opt/tyk-gateway/policies/policies.json"
  },
  "hash_keys": true,
  "close_connections": false,
  "http_server_options": {
    "enable_websockets": true,
    "read_timeout": 300,
    "write_timeout": 300
  },
  "allow_insecure_configs": true,
  "coprocess_options": {
    "enable_coprocess": true,
    "coprocess_grpc_server": "",
    "python_path_prefix": "/opt/tyk-gateway"
  },
  "enable_bundle_downloader": true,
  "bundle_base_url": "http://127.0.0.1:8888",
  "global_session_lifetime": 100,
  "force_global_session_lifetime": false,
  "max_idle_connections_per_host": 500,
  "log_level": "info",
  "proxy_default_timeout": 300
}

I played around with specifying coprocess_options.python_version but couldn’t make it work with it yet.

Here are the python versions that are installed on the image:

root@87c213324792:/opt/tyk-gateway# python -V
Python 3.9.0
root@87c213324792:/opt/tyk-gateway# python3 -V
Python 3.9.0
root@87c213324792:/opt/tyk-gateway# python3.9 -V
Python 3.9.0
root@87c213324792:/opt/tyk-gateway# python-config --ldflags
 -L/usr/local/lib  -lcrypt -lpthread -ldl  -lutil -lm -lm
root@87c213324792:/opt/tyk-gateway# python3-config --ldflags
 -L/usr/local/lib  -lcrypt -lpthread -ldl  -lutil -lm -lm
root@87c213324792:/opt/tyk-gateway# python3.9-config --ldflags
 -L/usr/local/lib  -lcrypt -lpthread -ldl  -lutil -lm -lm

Any luck @Pete ? Is there anything else I can provide you to make this easier to debug?

Hi @tobiasb

Thanks for the tyk.conf. That confirms that coprocess_options.python_version isn’t specified which was the first thing I thought of.

I’ll build a buster install today and have a look. Could you confirm which version of the gateway you’re running and did you build from source or install a package?

Cheers,
Pete

Scratch that I can see from your package list it’s 3.2.2.

I’m confused by the presence of python 3.9 and its libraries. My apparently up to date version of buster only has 3.7 and your list of installed packages says 3.7.

Where has 3.9 come from?

Cheers,
Pete

@Pete we’re using python:3.9-slim-buster from Docker

Thanks,

That’s an important detail.

Can you confirm that you’ve got the dependencies in place from the docs?

Cheers,
Pete

I think to. Let me paste my Dockerfile here @Pete. Please let me know if you see anything missing here.

FROM python:3.9-slim-buster

RUN python -m pip install --upgrade pip && \
    pip install pipenv

# from https://tyk.io/docs/tyk-oss/ce-debian-ubuntu/
RUN apt-get install -y gnupg redis-server && \
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
# end from

# from https://packagecloud.io/tyk/tyk-gateway/install#manual-deb
RUN apt-get update && \
    apt-get install -y debian-archive-keyring && \
    apt-get install -y curl gnupg apt-transport-https && \
    curl -L https://packagecloud.io/tyk/tyk-gateway/gpgkey | apt-key add - && \
    echo 'deb https://packagecloud.io/tyk/tyk-gateway/debian/ buster main\n\
deb-src https://packagecloud.io/tyk/tyk-gateway/debian/ buster main' >> /etc/apt/sources.list.d/tyk_tyk-gateway.list && \
    cat /etc/apt/sources.list.d/tyk_tyk-gateway.list && \
    apt-get update
# end from

# from https://tyk.io/docs/plugins/supported-languages/rich-plugins/python/python/
RUN apt-get install -y python3 python3-dev python3-pip build-essential libpython3-dev
RUN pip install protobuf grpcio
# end from

RUN apt-get install -y tyk-gateway && \
    echo "installing packages required by python package xmlsec" && \
    apt-get install -y pkg-config gcc libxml2-dev libxmlsec1-dev libxmlsec1-openssl && \
    rm /opt/tyk-gateway/apps/app_sample.json

COPY Pipfile Pipfile
COPY Pipfile.lock Pipfile.lock

RUN pipenv install --dev --system --deploy --ignore-pipfile --sequential && rm Pipfile*

COPY src /opt/app/src/

RUN cd /opt/app/src && \
    /opt/tyk-gateway/tyk bundle build --skip-signing --output="../middleware.zip"

WORKDIR /opt/tyk-gateway/
...

Hi @tobiasb

I’m really sorry that I missed the detail of your original analysis and didn’t see that the python-config output was changed. We will have to update Tyk to make it understand the new output.

In the mean time, could you try creating a soft link to the name that tyk is deriving and try again?

sudo ln -s /usr/local/lib/libpython3.9.so /usr/local/lib/lib.so

Cheers,
Pete

@Pete thanks for the suggestion, however it’s not quite working yet. The error is now

time="Jan 28 18:50:05" level=info msg="Loading existing bundle: middleware.zip" prefix=main
time="Jan 28 18:50:05" level=info msg="----> Loading bundle: middleware.zip" prefix=main
time="Jan 28 18:50:05" level=info msg="--> [REDIS] Creating single-node client"
time="Jan 28 18:50:05" level=info msg="----> Using bundle: middleware.zip" prefix=main
time="Jan 28 18:50:05" level=fatal msg="Couldn't initialize Python" prefix=coprocess

Here’s the lib folder content after creating the symlink

total 3780
   4 drwxr-xr-x 1 root root     4096 Jan 28 18:46 .
   8 drwxr-xr-x 1 root root     4096 Nov 16  2020 ..
   0 lrwxrwxrwx 1 root root       30 Jan 28 18:46 lib.so -> /usr/local/lib/libpython3.9.so
   0 lrwxrwxrwx 1 root root       19 Nov 24  2020 libpython3.9.so -> libpython3.9.so.1.0
3736 -rwxr-xr-x 1 root root  3821832 Nov 24  2020 libpython3.9.so.1.0
  16 -rwxr-xr-x 1 root root    14016 Nov 24  2020 libpython3.so
   4 drwxr-xr-x 2 root root     4096 Nov 24  2020 pkgconfig
   4 drwxrwsr-x 3 root staff    4096 Jan 28 18:38 python3.7
   8 drwxr-xr-x 1 root root     4096 Nov 24  2020 python3.9

Is there anything else I’m missing. Any luck on your side making this work?

Hi,

Because of the change in python-config output format you helpfully pointed out, tyk doesn’t currently work with python later than 3.7 although we’re currently working on an enhancement for later versions.

Is there something you need to do which python 3.7 can’t do?

Cheers,
Pete

Ok thanks for letting me know. We were on 3.6 which is no longer supported and moved straight to 3.9. We’ll have to find an alternative then, no problem. Thanks for your help, I really appreciate it.