Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install PL/Python on Windows for PostgreSQL 12

I've been working on FHIR for a project and we are using PostgreSQL as a database. While reading docs, I've come to know about PL/Python and decided to give it a shot but I am unable to install the python extension.

When I run the command CREATE EXTENSION pypthon3u; I get the following error

Could not load library "C:/Program Files/PostgreSQL/12/lib/plpython3.dll": The specified module could not be found.

I've checked this SO answer but it couldn't help.

My PostgreSQL version: PostgreSQL 12.2, compiled by Visual C++ build 1914, 64-bit

Installed Python version: 3.7.7 (64 Bit)

OS Info: Windows 10 Enterprise Version 1909 OS Build 18363.657

For me, it looks like incorrect version of Python but I'm installing python 3.7.* version against which PostgreSQL is compiled as specified in doc\installation-notes.html inside the install directory.

like image 653
Khizar Iqbal Avatar asked Mar 27 '26 08:03

Khizar Iqbal


1 Answers

Even if you use the EDB installer's Stack Builder to install Python, you still have to follow the instructions to "ensure they are included in the PATH variable under which the database server will be started". I had to do this at the system level, as I can't find a way to set the PATH for individual services.

And then you also need to set PYTHONPATH as well, which seems to be undocumented.

So I ended up adding c:\edb\languagepack\v1\Python-3.7 to PATH and creating PYTHONPATH with c:\edb\languagepack\v1\Python-3.7\Lib.

like image 136
jjanes Avatar answered Mar 29 '26 22:03

jjanes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!