how to install plpython for postgres?

Viewed 1624

I have postgres image: https://hub.docker.com/_/postgres I am trying to create the python extension with the following command:

create extension plpythonu

but it fail with the error:

psql:/docker-entrypoint-initdb.d/init.sql:1: ERROR:  could not open extension control file "/usr/share/postgresql/12/extension/plpythonu.control": No such file or directory

in my Dockerfile I try to install the package:

FROM postgres
RUN apt-get update -y
RUN apt install postgresql-plpython3-12

I get error:


Unable to locate package postgresql-plpython3-12

How can I extend the postgresql so that I can use python ?

1 Answers

I have found a solution to install plpython3 into my postgres container

FROM postgres

RUN apt-get update
RUN apt-get -y install python3 postgresql-plpython3-12
COPY pg-setup-scripts/init.sql /docker-entrypoint-initdb.d

and then in the entrypoint script


create extension plpython3u;

Related