How to Install a Python Package on Linux So That It Is Found by the Already Working Postgresql 13 Plpython3U Extension

How to install a Python package on Linux so that it is found by the already working PostgreSQL 13 plpython3u extension?

The issue is that this:

python3.8 -m pip install pandas

installs a package(pandas in this case) to the site-packages in the home directory of the user running the command, so:

/home/my_user/.local/lib/python3.8/site-packages

The plpython3u extension running in Postgres is looking for the package in the system wide site-packages. To get the package there you need to do:

sudo python3.8 -m pip install pandas

PostgreSQL: how to install plpythonu extension

You're using a PostgreSQL package from Bitnami, in /opt. It's not clear if you installed this with apt-get or via an installer script/program, but in either case it's not the same PostgreSQL as what's in the Ubuntu postgresql package.

Installing postgresql-plpython won't do you any good, because you're installing PL/Python support for a different PostgreSQL install than the one you're actually using.

You'll need to use the same installation method you originally used to install the Bitnami PostgreSQL to add PL/Python support, if it's available. It might not be provided by Bitnami.

Otherwise, if you're not too attached to using Bitnami's PostgreSQL, you could use the recommended packages from http://apt.postgresql.org/ .

PostgreSQL 13 + Python 3.7.9 + plpython3u: 'psql: server closed the connection unexepectedly.' + 'The application has lost the database connection.'

Workaround for Windows and Postgres 13

I was finally able to make it work with Python 3.7.0.
If anybody is looking for a solution they can install Python 3.7.0. Of course any new introduced in subsequent versions will not be available. I had to refactor my code to remove f-strings. Its a small trade-off for the convenience of using Python in stored procedures and functions.

PostgresSQL version: 13.4-2

Python version download link https://www.python.org/ftp/python/3.7.0/python-3.7.0-amd64.exe

How do I build and install PL/Python against a custom Postgresql (e.g. PG_CONFIG)?

Normally, the provider of your PipelineDB distribution should also provide the contrib package, so the correct answer depends on how your PipelineDB got installed.
If this is not the case (seems it is not): plpythonu is a PostgreSQL contrib package, and its source code is part of the PostgreSQL source code, and of any fork's source code as well. A simple Google search for pipelinedb plpythonu reveals the location of pipelinedb source on the GitHub. Generally, you clone the source for your version of PipelineDB, and then

cd src/pl/plpython
make
make install

Probably it's a bit more complicated than that; here's a PipelineDB build script for Arch Linux which handles these.

Postgres plpythonu extension doesn't exist in /usr/pgsql-9.3/share/extension

PL/Python isn't installed. In most Linux packages of PostgreSQL it's a separate package.

If you're using apt.postgresql.org (PGDG) packages on Debian/Ubuntu:

apt-get install postgresql-contrib-9.3 postgresql-plpython-9.3

If you're on Ubuntu or Debian with their stock PostgreSQL packages:

apt-get install postgresql-contrib postgresql-plpython

If you're on Fedora/CentOS/RhEL with PGDG packages from yum.postgresql.org:

yum install postgresql93-contrib postgresql93-plpython

If you're on Fedora/CentOS/RHEL with stock packages:

yum install postgresql-contrib postgresql-plpython

The contrib packages aren't strictly required, but you're likely to want them too.



Related Topics



Leave a reply



Submit