In your PostgresSQL database, want to be Python enables an SQL developer to write procedural language functions for PostgreSQL 11 in Python. You need to install the package if you have any PostgreSQL 11 functions that use the languages plpython or plpythonu. PostgreSQL is an object-relational SQL database management system.

Before you start the installation please ensure that have you already installed packages using the command below,

select * from pg_language; 

If it's not, please go ahead with the steps below,

Initially, identify which versions are available in your instance,


$ sudo apt-cache search ".*plpython3.*"

postgresql-plpython3-11 - PL/Python 3 procedural language for PostgreSQL 11


The PostgreSQL version is 11,

$ sudo apt-get install postgresql-contrib postgresql-plpython3-11 -y

Login to the database

$ sudo su - postgres

or

$ psql -h -p 5432 -U -W


Created the plpython3u extension and verify it.

DATABASE=#  CREATE EXTENSION plpython3u;

DATABASE=# select * from pg_language;

  lanname   | lanowner | lanispl | lanpltrusted | lanplcallfoid | laninline | lanvalidator | lanacl 
------------+----------+---------+--------------+---------------+-----------+--------------+--------
 internal   |       10 | f       | f            |             0 |         0 |         2246 | 
 c          |       10 | f       | f            |             0 |         0 |         2247 | 
 sql        |       10 | f       | t            |             0 |         0 |         2248 | 
 plpgsql    |       10 | t       | t            |         13078 |     13079 |        13080 | 
 plpython3u |    16384 | t       | f            |        320421 |    320422 |       320423 | 
(5 rows)