To get the obvious out of the way, my question is posted after reading many other questions like this one
https://stackoverflow.com/questions/60683776/install-pl-python-on-windows-for-postgresql-12 But I ve been stuck for about a month and half now when trying to use pl/python.I'm using Postgresql 12 with the enterprisedb package including pgadmin4 as a gui and the language pack . So PL python is supposed to be included.When i ran "CREATE EXTENSION plpython3u;"
I got the following message ERROR: ライブラリ"C:/Program Files/PostgreSQL/12/lib/plpython3.dll"をロードできませんでした: The specified module could not be found. SQL state: 58P01which is the classic
"ERROR: could not load library "C:/Program Files/PostgreSQL/12/lib/plpython3.dll": The specified module could not be found."
My understanding, based on reading multiples posts and articles, is that 2 elements are required
1. the proper python interpreter
Python runtime needs to match the PostgresSQL version The documentation within the PostgreSQL folder indicates The procedural languages pl/Perl, pl/Python and pl/Tcl are included in this distribution of PostgreSQL. The server has been built using the LanguagePack community distributions of those language interpreters. To use any of the these languages from within PostgreSQL, download and install the appropriate interpreters and ensure they are included in the PATH variable under which the database server will be started. The versions used are shown below - newer minor (bugfix) releases may also work, but have not been tested:
* Python 3.7
Also when running plpython3.DLL found in C:\program files\postgresql\12\lib through the software "dependency walker" I get the following result :
Which would mean that -it's indeed python 3.7 which is required as mentioned in the doc. -the dependency was found.
2. setting the environment variables PATH and PYTHONHOME
Now both the documentation https://www.enterprisedb.com/edb-docs/d/edb-postgres-advanced-server/user-guides/language-pack-guide/12/EDB_Postgres_Language_Pack_Guide.1.09.html# and a forum help administrator https://postgresrocks.enterprisedb.com/t5/PostgreSQL/unable-to-install-pl-python-extension/td-p/4059/
mentions the needs to change environment variables PATH and PYTHONHOME. something along the lines of
set PYTHON_HOME=c:\ edb\languagepack\v1\Python-3.7
set PATH=C:\edb\languagepack\v1\Python-3.7;C:\edb\languagepack\v1\Perl-5.26\bin; C:\edb\languagepack\v1\Tcl-8.6\bin;%PATH%
the forum mentions you need to change those with the command prompt. the doc isn't specific as to how you re supposed to do that but i figured it meant the python interpreter itself
either way it doesnt work. when I use the command prompt there is no answer: no error, no nothing. It just starts new on another line. in python interpreter, the syntax is invalid. and when I use the query in pgadmin I have the same error. I saw other possible methods like a batch file or windows settings but it seems completely different.
I really want to move forward after being stuck so long and would much appreciate some insight.