Thread: Installing support for python on windows
I've spent a couple of hours on this and would like to ask for an assist at this point. I need to install python support on windows. The postgresql install is the windows 8.2.0-1 binary, and pl/pgsql was included in the initial installation. I have python 2.5 installed. The workstation's path does not ref either the python or postgres directories. - I take it that plpython is what I should be installing? I first read in this list that psycopg is commonly used to work with python in postgres, and I installed the windows port of that, but 'nothing happened' ie no python lang support materialized. I'm not at all sure what the score is with psycopg and plpython, but am now aiming for plpython as that seems to be the offering that is included with the postgres installer. But I'm curious, why psycopg when plpython is there? Are they complimentary, or should it be one or the other? - The postgresql docs reference plpythonu (untrusted) but what I find in \lib is plpython? Are the docs out of date or am I mixing up information? (http://www.postgresql.org/docs/8.2/interactive/plpython.html) - Per most docs the installation of a language is done with createlang. I've tried many times and cannot get the syntax right. Typically I log in to psql in the \bin directory as the main postgres user. After that, a typical attempt is looks like this: postgres=# createlang 'd:\postgresql\lib\plpython' mydb; Typical error is: ERROR: syntax error at or near "createlang" LINE 1: createlang d: This is a later attempt where I've added the lib path. I've tried no path, double quotes, many things. I've tried executing from the windows command line (ie not while in psql), adding the dll extension. Rather than spending the rest of the year on this (ie ten hours <g>) I hope someone can knock out a line or two to steer me in the right direction. -- View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tf2902841.html#a8110347 Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On Sunday 31 December 2006 2:09 pm, novnov wrote:
> I've spent a couple of hours on this and would like to ask for an assist at
> this point. I need to install python support on windows. The postgresql
> install is the windows 8.2.0-1 binary, and pl/pgsql was included in the
> initial installation. I have python 2.5 installed. The workstation's path
> does not ref either the python or postgres directories.
>
> - I take it that plpython is what I should be installing? I first read in
> this list that psycopg is commonly used to work with python in postgres,
> and I installed the windows port of that, but 'nothing happened' ie no
> python lang support materialized. I'm not at all sure what the score is
> with psycopg and plpython, but am now aiming for plpython as that seems to
> be the offering that is included with the postgres installer. But I'm
> curious, why psycopg when plpython is there? Are they complimentary, or
> should it be one or the other?
Psycopg is an interface from Python to Postgres. In other words it works from the outside. You use it to connect a Postgres database and manipulate data as needed. plpython is a procedural language for Postgres that allows one to use Python from within the server. For what you want to do plpython is the choice.
>
> - The postgresql docs reference plpythonu (untrusted) but what I find in
> \lib is plpython? Are the docs out of date or am I mixing up information?
> (http://www.postgresql.org/docs/8.2/interactive/plpython.html)
>
I haven't installed Postgres on Windows so I am not familiar with the naming there. At one time there was a plpython but this has been replaced by plpythonu as Python did not have a robust mechanism for keeping the language from straying outside the server.
> - Per most docs the installation of a language is done with createlang.
> I've tried many times and cannot get the syntax right. Typically I log in
> to psql in the \bin directory as the main postgres user. After that, a
> typical attempt is looks like this:
>
> postgres=# createlang 'd:\postgresql\lib\plpython' mydb;
>
> Typical error is:
> ERROR: syntax error at or near "createlang"
> LINE 1: createlang d:
>
> This is a later attempt where I've added the lib path. I've tried no path,
> double quotes, many things. I've tried executing from the windows command
> line (ie not while in psql), adding the dll extension. Rather than spending
> the rest of the year on this (ie ten hours <g>) I hope someone can knock
> out a line or two to steer me in the right direction.
Just for reference sake, did you try createlang -d mydb plpythonu
See URL below for more information
http://www.postgresql.org/docs/8.2/interactive/app-createlang.html
--
Adrian Klaver
aklaver@comcast.net
novnov <novnovice@gmail.com> writes: > - Per most docs the installation of a language is done with createlang. I've > tried many times and cannot get the syntax right. Typically I log in to psql > in the \bin directory as the main postgres user. After that, a typical > attempt is looks like this: > postgres=# createlang 'd:\postgresql\lib\plpython' mydb; > Typical error is: > ERROR: syntax error at or near "createlang" > LINE 1: createlang d: createlang is a command-line program, not a SQL command. You can use the equivalent CREATE LANGUAGE command if you want to do it from the SQL prompt. regards, tom lane
Thanks to both of you. I tried the following and got an error that plpython.dll couldn't be found: D:\postgresql\bin>createlang -U sauser plpythonu mydb Password: createlang: language installation failed: ERROR: could not load library "D:/pos tgresql/lib/plpython.dll": The specified module could not be found. The file spec'd by the error message does indeed exist, though the slashes in windows would of course be the other way around in normal use. Then I tried leaving of the u in plpythonu D:\postgresql\bin>createlang -U sauser plpython mydb Password: createlang: language installation failed: ERROR: unsupported language "plpython" HINT: The supported languages are listed in the pg_pltemplate system catalog. Then I tried something like what Adrian had suggested: D:\postgresql\bin>createlang -U sauser -d mydb plpythonu Password: createlang: language installation failed: ERROR: could not load library "D:/pos tgresql/lib/plpython.dll": The specified module could not be found. It's interesting that createlang knows to look in the peer lib directory for the language file but somehow does not like the plpython that it sees there. I also tried plpython (no trailing u) and had the same error as the earlier experiment. -- View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tf2902841.html#a8111635 Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On Sunday 31 December 2006 7:06 pm, novnov wrote: > Thanks to both of you. I tried the following and got an error that > plpython.dll couldn't be found: > > D:\postgresql\bin>createlang -U sauser plpythonu mydb > Password: > createlang: language installation failed: ERROR: could not load library > "D:/pos > tgresql/lib/plpython.dll": The specified module could not be found. > > The file spec'd by the error message does indeed exist, though the slashes > in windows would of course be the other way around in normal use. Then I > tried leaving of the u in plpythonu > > D:\postgresql\bin>createlang -U sauser plpython mydb > Password: > createlang: language installation failed: ERROR: unsupported language > "plpython" > HINT: The supported languages are listed in the pg_pltemplate system > catalog. > > Then I tried something like what Adrian had suggested: > > D:\postgresql\bin>createlang -U sauser -d mydb plpythonu > Password: > createlang: language installation failed: ERROR: could not load library > "D:/pos > tgresql/lib/plpython.dll": The specified module could not be found. > > It's interesting that createlang knows to look in the peer lib directory > for the language file but somehow does not like the plpython that it sees > there. I also tried plpython (no trailing u) and had the same error as the > earlier experiment. At this point I don't know what to say. Hopefully someone with with experience installing Postgres on Windows can help out. -- Adrian Klaver aklaver@comcast.net
novnov wrote: > Then I tried something like what Adrian had suggested: > > D:\postgresql\bin>createlang -U sauser -d mydb plpythonu > Password: > createlang: language installation failed: ERROR: could not load library > "D:/pos > tgresql/lib/plpython.dll": The specified module could not be found. > > It's interesting that createlang knows to look in the peer lib directory for > the language file but somehow does not like the plpython that it sees there. > I also tried plpython (no trailing u) and had the same error as the earlier > experiment. Most likely it's not finding the require python DLLs in the system PATH, just the plpython one. Make sure that your actual python directory is in the PATH, add it if not. If it is, use the "depends" tool (part of the support tools) to verify exactly what DLL it's not finding. //Magnus
This is so much more difficult than I imagined it could be. I've added the main python dir and the lib dir to my path and nothing has changed. I may be able to figure out how to use the depends tool, so far it looks pretty obscure to a newb. This is all being done on a new workstation. It is a little puzzling that straight up installs of postgres and python result in a config that doesn't respond to the supposedly simple one line command to add python support. I've read about this for hours and it does not normally appear to be a problematic process. Thanks to both of you for trying to help. Magnus Hagander-2 wrote: > > novnov wrote: >> Then I tried something like what Adrian had suggested: >> >> D:\postgresql\bin>createlang -U sauser -d mydb plpythonu >> Password: >> createlang: language installation failed: ERROR: could not load library >> "D:/pos >> tgresql/lib/plpython.dll": The specified module could not be found. >> >> It's interesting that createlang knows to look in the peer lib directory >> for >> the language file but somehow does not like the plpython that it sees >> there. >> I also tried plpython (no trailing u) and had the same error as the >> earlier >> experiment. > > Most likely it's not finding the require python DLLs in the system PATH, > just the plpython one. Make sure that your actual python directory is in > the PATH, add it if not. If it is, use the "depends" tool (part of the > support tools) to verify exactly what DLL it's not finding. > > //Magnus > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > > -- View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tf2902841.html#a8116019 Sent from the PostgreSQL - general mailing list archive at Nabble.com.
novnov wrote: > This is so much more difficult than I imagined it could be. I've added the > main python dir and the lib dir to my path and nothing has changed. I may be > able to figure out how to use the depends tool, so far it looks pretty > obscure to a newb. It should be easy enough - just run "depends plpython.dll" in the directory where plpython is. Two things to verify first: 1) Verify that you added the directories to the system path, and not your personal path 2) Did you restart the server after adding it? Needs to be done for windows to pick up the change in environment. //Magnus
On Monday 01 January 2007 11:14 am, Magnus Hagander wrote: > novnov wrote: > > This is so much more difficult than I imagined it could be. I've added > > the main python dir and the lib dir to my path and nothing has changed. I > > may be able to figure out how to use the depends tool, so far it looks > > pretty obscure to a newb. > > It should be easy enough - just run "depends plpython.dll" in the > directory where plpython is. > > Two things to verify first: > 1) Verify that you added the directories to the system path, and not > your personal path > 2) Did you restart the server after adding it? Needs to be done for > windows to pick up the change in environment. > > > //Magnus > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match I broke down and installed Postgres on Windows. I had the same problem with installing plpython until I did as Magnus suggested, rebooted Windows. I then ran createlang -d template1 -U postgres plpythonu to install it into the template1 database and it succeeded. -- Adrian Klaver aklaver@comcast.net
Adrian Klaver wrote: > > On Monday 01 January 2007 11:14 am, Magnus Hagander wrote: >> novnov wrote: >> > This is so much more difficult than I imagined it could be. I've added >> > the main python dir and the lib dir to my path and nothing has changed. >> I >> > may be able to figure out how to use the depends tool, so far it looks >> > pretty obscure to a newb. >> >> It should be easy enough - just run "depends plpython.dll" in the >> directory where plpython is. >> >> Two things to verify first: >> 1) Verify that you added the directories to the system path, and not >> your personal path >> 2) Did you restart the server after adding it? Needs to be done for >> windows to pick up the change in environment. >> >> >> //Magnus >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 9: In versions below 8.0, the planner will ignore your desire to >> choose an index scan if your joining column's datatypes do not >> match > I broke down and installed Postgres on Windows. I had the same problem > with > installing plpython until I did as Magnus suggested, rebooted Windows. I > then > ran createlang -d template1 -U postgres plpythonu to install it into the > template1 database and it succeeded. > -- > Adrian Klaver > aklaver@comcast.net > That's encouraging. But I rebooted as a part of my original testing after adding to path, and just now again. I tried with your -d syntax too and still the same error. I'll try depend next. -- View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tf2902841.html#a8118133 Sent from the PostgreSQL - general mailing list archive at Nabble.com.
It should be easy enough - just run "depends plpython.dll" in the directory where plpython is. Two things to verify first: 1) Verify that you added the directories to the system path, and not your personal path 2) Did you restart the server after adding it? Needs to be done for windows to pick up the change in environment. >>>> plpython.dll is in the lib dir. But at a command prompt there, "depends plpython.dll" just gets me 'depends' is not recognized as an internal or external command etc. The postgres docs talk about the catalog pg_depend, and maybe 'depends' is another executable that calls that, but I've not been able to find a 'depends.exe'. depends does not seem to fly in psql. The pg_depends docs don't really tell me how to use pg_depends on it's own...I don't know anything about catalogs, or it'd probably be obvious. The server was restarted and the path modified was for the server. Thanks -- View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tf2902841.html#a8118252 Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On Monday 01 January 2007 3:39 pm, novnov wrote: > It should be easy enough - just run "depends plpython.dll" in the > directory where plpython is. > > Two things to verify first: > 1) Verify that you added the directories to the system path, and not > your personal path > 2) Did you restart the server after adding it? Needs to be done for > windows to pick up the change in environment. > > > plpython.dll is in the lib dir. But at a command prompt there, "depends > plpython.dll" just gets me > > 'depends' is not recognized as an internal or external command etc. > > The postgres docs talk about the catalog pg_depend, and maybe 'depends' is > another executable that calls that, but I've not been able to find a > 'depends.exe'. depends does not seem to fly in psql. The pg_depends docs > don't really tell me how to use pg_depends on it's own...I don't know > anything about catalogs, or it'd probably be obvious. > > The server was restarted and the path modified was for the server. Thanks Depends is a windows program. To get it I had to load the Windows support tools from the Windows install disc(in my case the image on my harddrive). -- Adrian Klaver aklaver@comcast.net
Thanks, the depends tools looks very handy, surprising I'd not heard of it before. I found that the postgresql\bin dir must be added to the path. Also, I had python 2.5 installed, and plpython apparently needs python 2.4. I've installed that and added to the path, but there is another dependency missing inside of the python stack, "DWMAPI.dll". Googling DWMAPI.dll gets a mixed bag, but I think that it might be part of IE6, and not IE7 (I have IE7). Maybe the current plpython does not work unless IE6 is installed, because plpython needs python 2.4, which needs IE 6??? Adrian Klaver wrote: > > On Monday 01 January 2007 3:39 pm, novnov wrote: >> It should be easy enough - just run "depends plpython.dll" in the >> directory where plpython is. >> >> Two things to verify first: >> 1) Verify that you added the directories to the system path, and not >> your personal path >> 2) Did you restart the server after adding it? Needs to be done for >> windows to pick up the change in environment. >> >> >> plpython.dll is in the lib dir. But at a command prompt there, "depends >> plpython.dll" just gets me >> >> 'depends' is not recognized as an internal or external command etc. >> >> The postgres docs talk about the catalog pg_depend, and maybe 'depends' >> is >> another executable that calls that, but I've not been able to find a >> 'depends.exe'. depends does not seem to fly in psql. The pg_depends docs >> don't really tell me how to use pg_depends on it's own...I don't know >> anything about catalogs, or it'd probably be obvious. >> >> The server was restarted and the path modified was for the server. Thanks > Depends is a windows program. To get it I had to load the Windows support > tools from the Windows install disc(in my case the image on my harddrive). > -- > Adrian Klaver > aklaver@comcast.net > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > > -- View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tf2902841.html#a8119308 Sent from the PostgreSQL - general mailing list archive at Nabble.com.
On Monday 01 January 2007 6:24 pm, novnov wrote: > Thanks, the depends tools looks very handy, surprising I'd not heard of it > before. > > I found that the postgresql\bin dir must be added to the path. > > Also, I had python 2.5 installed, and plpython apparently needs python 2.4. > I've installed that and added to the path, but there is another dependency > missing inside of the python stack, "DWMAPI.dll". Googling DWMAPI.dll gets > a mixed bag, but I think that it might be part of IE6, and not IE7 (I have > IE7). Maybe the current plpython does not work unless IE6 is installed, > because plpython needs python 2.4, which needs IE 6??? > I installed with python 2.5 and IE7 with no problem. -- Adrian Klaver aklaver@comcast.net
Whew, python lang support just installed for me too. After reading more, it seems that while there is some broken dependency re DWMAPI.dll on windowsxp systems, it does not affect most programs. DWMAPI.dll is shown as missing by 'depends' but that exposes delay-loaded problems that may have little real world impact. The best thread on the matter seems to be http://episteme.arstechnica.com/eve/forums/a/tpc/f/99609816/m/494009191831. I'd not tried createlang since fixing the basic python and postgres path issues, and had assumed that the remaining problem exposed by 'depends' was a show stopper. I wonder if it should be included in the docs for installing langs that on windows postgresql\bin and python24 and python24\lib need to be in the path? And that the current windows installer dll requires python 2.4? Thanks Adrian for all of your assistance. Adrian Klaver wrote: > > On Monday 01 January 2007 6:24 pm, novnov wrote: >> Thanks, the depends tools looks very handy, surprising I'd not heard of >> it >> before. >> >> I found that the postgresql\bin dir must be added to the path. >> >> Also, I had python 2.5 installed, and plpython apparently needs python >> 2.4. >> I've installed that and added to the path, but there is another >> dependency >> missing inside of the python stack, "DWMAPI.dll". Googling DWMAPI.dll >> gets >> a mixed bag, but I think that it might be part of IE6, and not IE7 (I >> have >> IE7). Maybe the current plpython does not work unless IE6 is installed, >> because plpython needs python 2.4, which needs IE 6??? >> > > I installed with python 2.5 and IE7 with no problem. > > -- > Adrian Klaver > aklaver@comcast.net > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > > -- View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tf2902841.html#a8135655 Sent from the PostgreSQL - general mailing list archive at Nabble.com.
<resurrection> Ok so i am having trouble installing plpython, and found this thread. Howevre, after adding postgresql/bin to the path and the python lib directory to the path i still get: createlang: language installation failed: ERROR: could not load library "C:/Pro gram Files/PostgreSQL/8.2/lib/plpython.dll": The specified module could not be f ound. so maybe im doing the path thing wrong? i used : C:\Program Files\PostgreSQL\8.2\bin>set PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Python24\Lib;c:\Program Files\PostggreSQL\8.2\bin;c:\Program Files\PostggreSQL\8.2\lib so if that is correct what else am i missing? On 1/2/07, novnov <novnovice@gmail.com> wrote: > > Whew, python lang support just installed for me too. > > After reading more, it seems that while there is some broken dependency re > DWMAPI.dll on windowsxp systems, it does not affect most programs. > DWMAPI.dll is shown as missing by 'depends' but that exposes delay-loaded > problems that may have little real world impact. The best thread on the > matter seems to be > http://episteme.arstechnica.com/eve/forums/a/tpc/f/99609816/m/494009191831. > I'd not tried createlang since fixing the basic python and postgres path > issues, and had assumed that the remaining problem exposed by 'depends' was > a show stopper. > > I wonder if it should be included in the docs for installing langs that on > windows postgresql\bin and python24 and python24\lib need to be in the path? > And that the current windows installer dll requires python 2.4? > > Thanks Adrian for all of your assistance. > > > Adrian Klaver wrote: > > > > On Monday 01 January 2007 6:24 pm, novnov wrote: > >> Thanks, the depends tools looks very handy, surprising I'd not heard of > >> it > >> before. > >> > >> I found that the postgresql\bin dir must be added to the path. > >> > >> Also, I had python 2.5 installed, and plpython apparently needs python > >> 2.4. > >> I've installed that and added to the path, but there is another > >> dependency > >> missing inside of the python stack, "DWMAPI.dll". Googling DWMAPI.dll > >> gets > >> a mixed bag, but I think that it might be part of IE6, and not IE7 (I > >> have > >> IE7). Maybe the current plpython does not work unless IE6 is installed, > >> because plpython needs python 2.4, which needs IE 6??? > >> > > > > I installed with python 2.5 and IE7 with no problem. > > > > -- > > Adrian Klaver > > aklaver@comcast.net > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: don't forget to increase your free space map settings > > > > > > -- > View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tf2902841.html#a8135655 > Sent from the PostgreSQL - general mailing list archive at Nabble.com. > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
On Tue, Feb 20, 2007 at 05:15:38PM -0500, Rhys Stewart wrote: > <resurrection> > > Ok so i am having trouble installing plpython, and found this thread. > Howevre, after adding postgresql/bin to the path and the python lib > directory to the path i still get: > createlang: language installation failed: ERROR: could not load library > "C:/Pro > gram Files/PostgreSQL/8.2/lib/plpython.dll": The specified module could not > be f > ound. > > so maybe im doing the path thing wrong? i used : > > C:\Program Files\PostgreSQL\8.2\bin>set > PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Python24\Lib;c:\Program > Files\PostggreSQL\8.2\bin;c:\Program Files\PostggreSQL\8.2\lib > > so if that is correct what else am i missing? Please run the depends.exe tool from the Windows Support Tools to determine which module it's failing to load. //Magnus
Hello, I have the same problem. I've checked plpython.dll dependencies with depends tool and all is correct. I tried to install plperl with no success. What can I do? Magnus Hagander-2 wrote: > > On Tue, Feb 20, 2007 at 05:15:38PM -0500, Rhys Stewart wrote: >> <resurrection> >> >> Ok so i am having trouble installing plpython, and found this thread. >> Howevre, after adding postgresql/bin to the path and the python lib >> directory to the path i still get: >> createlang: language installation failed: ERROR: could not load library >> "C:/Pro >> gram Files/PostgreSQL/8.2/lib/plpython.dll": The specified module could >> not >> be f >> ound. >> >> so maybe im doing the path thing wrong? i used : >> >> C:\Program Files\PostgreSQL\8.2\bin>set >> PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Python24\Lib;c:\Program >> Files\PostggreSQL\8.2\bin;c:\Program Files\PostggreSQL\8.2\lib >> >> so if that is correct what else am i missing? > > Please run the depends.exe tool from the Windows Support Tools to > determine which module it's failing to load. > > //Magnus > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > > -- View this message in context: http://www.nabble.com/Installing-support-for-python-on-windows-tp8110347p16396272.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.