Thread: pg.py under Mac OS X

pg.py under Mac OS X

From
mps@theintraweb.net
Date:
Hello Interfaces List,

I am trying to get python access to postgresql-7.4.7 under Mac OS X
10.3.8. When I compiled postgresql from the source I used --with-python,
but got the following error:

*** Cannot build PL/Python because libpython is not a shared library.
*** You might have to rebuild your Python installation.  Refer to
*** the documentation for details.

I figured I'd simply install PyGreSQL instead. I installed postgresql and
got it going then I dropped down the PyGreSQL-3.6.1 archive, untar'ed it
and ran:

python setup.py build

but got the following error:

gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd
-fno-common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
-I/usr/local/pgsql/include -I/usr/local/pgsql/include/server
-I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3
-c pgmodule.c -o build/temp.darwin-7.8.0-Power_Macintosh-2.3/pgmodule.o
pgmodule.c:31:22: postgres.h: No such file or directory
pgmodule.c:34:29: catalog/pg_type.h: No such file or directory
pgmodule.c: In function `get_type_array':
pgmodule.c:300: error: `INT2OID' undeclared (first use in this function)
pgmodule.c:300: error: (Each undeclared identifier is reported only once
pgmodule.c:300: error: for each function it appears in.)
pgmodule.c:301: error: `INT4OID' undeclared (first use in this function)
pgmodule.c:305: error: `INT8OID' undeclared (first use in this function)
pgmodule.c:306: error: `OIDOID' undeclared (first use in this function)
pgmodule.c:310: error: `FLOAT4OID' undeclared (first use in this function)
pgmodule.c:311: error: `FLOAT8OID' undeclared (first use in this function)
pgmodule.c:312: error: `NUMERICOID' undeclared (first use in this function)
pgmodule.c:316: error: `CASHOID' undeclared (first use in this function)
error: command 'gcc' failed with exit status 1

After a quick search on my system, I find that postgres.h only exists in
the postgresql-7.4.7 source directory, and was not installed with the
headers in /usr/local/pgsql/include/

Is this correct? Should I be approaching this a different way? I am unsure
of how to continue to get this going.

Any help would be great,

Cheers

Matt Smith


Re: pg.py under Mac OS X

From
Tom Lane
Date:
mps@theintraweb.net writes:
> After a quick search on my system, I find that postgres.h only exists in
> the postgresql-7.4.7 source directory, and was not installed with the
> headers in /usr/local/pgsql/include/

You need to do "make install-all-headers" to get the server-side headers
installed in 7.4.  (IIRC we made this the default in 8.0, but it was not
default in any prior version.)
        regards, tom lane


Re: pg.py under Mac OS X

From
mps@theintraweb.net
Date:
> mps@theintraweb.net writes:
>> After a quick search on my system, I find that postgres.h only exists in
>> the postgresql-7.4.7 source directory, and was not installed with the
>> headers in /usr/local/pgsql/include/
>
> You need to do "make install-all-headers" to get the server-side headers
> installed in 7.4.  (IIRC we made this the default in 8.0, but it was not
> default in any prior version.)
>
>             regards, tom lane

Thanks, I got PyGreSQL working by pointing setup.py to the postgres
source, but this is a much better way :)

thanks.

Matt Smith