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/ .
how to install plpython for postgres?
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;
Installing plpythonu on Windows
Use specific python version on Windows. I could get it running with python 3.2.x with postgres 9.3
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
PostgreSQL unable to create plpythonu extension
The newest (9.4 or later) binary installations from EnterpriseDB contain only plpython3u.dll. In versions 9.4 to 9.6 I had to install python 3.3 to get plpython3u run.
You can check which version of Python is needed by plpython3u.dll using Dependency Walker.
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
Related Topics
How to Use the Python HTMLparser Library to Extract Data from a Specific Div Tag
Socketserver.Threadingtcpserver - Cannot Bind to Address After Program Restart
Name This Python/Ruby Language Construct (Using Array Values to Satisfy Function Parameters)
Pygame Already Installed; However, Python Terminal Says "No Module Named 'Pygame' " (Ubuntu 20.04.1)
Importing Variables from Another File
Python Setup.Py Develop VS Install
How to Drop a List of Rows from Pandas Dataframe
Concatenate Rows of Two Dataframes in Pandas
What's a Good Rate Limiting Algorithm
How to Find Tag with Particular Text with Beautiful Soup
Python in Raw Mode Stdin Print Adds Spaces
How to Make Ball Bounce Off Wall with Pygame
Regular Expression Matching a Multiline Block of Text
Python's Equivalent of && (Logical-And) in an If-Statement