Reply: Reply: [GENERAL] 回复: [GENERAL] Can't create plpython language
Problem with ActivePython-2.7.2.5 is
[postgres@lix stado]$ psql
psql (9.3beta2)
Type "help" for help.
postgres=# create language plpython2u;
ERROR: could not load library "/opt/PostgreSQL/93b2src/lib/postgresql/plpython2.so": /opt/PostgreSQL/93b2src/lib/postgresql/plpython2.so: undefined symbol: PyObject_Bytes
with environment variables as
export PGDATA=/opt/PostgreSQL/pgdata/93b2src
export PYTHONHOME=/opt/ActivePython-2.7
export PYTHONPATH=/opt/ActivePython-2.7/bin
export PATH=/opt/PostgreSQL/93b2src/bin:$PYTHONHOME/bin:$PATH
export LD_LIBRARY_PATH=$PYTHONHOME/lib:$LD_LIBRARY_PATH
------------------ Original ------------------
Sender: "Raghavendra"<raghavendra.rao@enterprisedb.com>;
Send time: Tuesday, Jul 16, 2013 4:53 PM
To: "guxiaobo1982"<guxiaobo1982@qq.com>;
Cc: "Jov"<amutu@amutu.com>; "Michael Paquier"<michael.paquier@gmail.com>; "pgsql-general"<pgsql-general@postgresql.org>; "Asif Naeem"<asif.naeem@enterprisedb.com>;
Subject: Re: Reply: [GENERAL] 回复: [GENERAL] Can't create plpython language
On Mon, Jul 15, 2013 at 7:10 PM, guxiaobo1982 <guxiaobo1982@qq.com> wrote:
It works with ActivePython 3.2.2.3,
Thanks for notifying.
but not ActivePython 2.7.2.5.
No idea... :), I tried AP 3.2 with PG 9.2 & PG 9.3B it went fine for me.
---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/
------------------ Original ------------------
From: "Raghavendra"<raghavendra.rao@enterprisedb.com>;
Date: Jul 11, 2013
To: "guxiaobo1982"<guxiaobo1982@qq.com>;
Cc: "Jov"<amutu@amutu.com>; "Michael Paquier"<michael.paquier@gmail.com>; "pgsql-general"<pgsql-general@postgresql.org>; "Asif Naeem"<asif.naeem@enterprisedb.com>;
Subject: Re: Reply: [GENERAL] 回复: [GENERAL] Can't create plpython language
On Wed, Jul 10, 2013 at 7:36 AM, guxiaobo1982 <guxiaobo1982@qq.com> wrote:
I am using PostgreSQL 9.3 beta 2
[postgres@lix Multicorn-master]$ psql
psql (9.3beta2)
Type "help" for help.
postgres=#
It does not work with ActivePython3.2(ActivePython-3.2.2.3-linux-x86_64.tar.gz), Which version of PostgreSQL are you running?
Sorry for being late on this email. I overlooked the version you were pointing. I didn't test on PG 9.3Beta, I did on PG 9.2 after looking your error showing PG 9.2.4
[postgres@lix PostgreSQL]$ psql
Password:
psql (9.2.4)
Type "help" for help.
postgres=# create language plpython2u;
ERROR: could not access file "$libdir/plpython2": No such file or directory
postgres=# create language plpython3u;
ERROR: could not access file "$libdir/plpython3": No such file or directory
Later, I began testing it with PG 9.3beta and encountered same error message as you have shared here.
Did some analysis and finally succeeded to create language plpython3u with AP-3.2, however with not many tweaks in compilation.(Steps might be arguing. Pardon me).
Despite the fact that I have ActivePython-3.2 on my system, source compilation was looking for shared library. Hence compiled explicitly with shared_libpython=yes.
Pre-Steps: (Assuming you have ActivePython 3.2)
cd /opt/ActivePython-3.2/bin/
cp python3.2-config python-config
cp python3. python
Test:
export PATH=/opt/ActivePython-3.2/bin:$PATH
# which python
/opt/ActivePython-3.2/bin/python
# which python-config
/opt/ActivePython-3.2/bin/python-config
Steps:
1. Install PG 9.3 beta with below steps:
export PATH=/opt/ActivePython-3.2/bin:$PATH
./configure --prefix=/usr/local/pg93b3 --with-python
make shared_libpython=yes
make shared_libpython=yes install
2. After installation you should see below files in your PG installation Path:
[root@localhost pg93b3]# pwd
/usr/local/pg93b3
[root@localhost pg93b3]# find . | grep python
./lib/postgresql/plpython3.so
./share/postgresql/extension/plpython3u--unpackaged--1.0.sql
./share/postgresql/extension/plpython3u--1.0.sql
./share/postgresql/extension/plpython3u.control
3. Now, create new cluster using INITDB
4. Before starting the cluster set the PYTHONHOME, PYTHONPATH, LD_LIBRARY_PATH
export PYTHONHOME=/opt/ActivePython-3.2/
export PYTHONPATH=/opt/ActivePython-3.2/bin:$PATH
export LD_LIBRARY_PATH=/opt/ActivePython-3.2/lib:$LD_LIBRARY_PATH
5. Start the cluster and create the language:
/usr/local/pg93b3/bin/pg_ctl -D /usr/local/pg93b3/data/ start
-bash-4.1$ psql -p 4444
psql (9.3beta1)
Type "help" for help.
postgres=# create language plpython3u;
CREATE LANGUAGE
Out of my analysis on the issue, Asif Naeem from our Dev group shared his valuable thoughts to conclude this. Thanks Asif.
Question still in mind, Why plpython depends on Shared Libraries (.so) ?
http://www.postgresql.org/docs/9.3/static/install-requirements.html
---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/
Foremost, its interesting, why your replies populate as distinct thread
rather than of continuing one. (I may be incorrect, are you choosing
"forward" option while replying, no ?). Request to hold the continuity of
the post instead of different chunks for each reply. :)
On Thu, Jul 18, 2013 at 12:04 PM, guxiaobo1982 <guxiaobo1982@qq.com> wrote:
Problem with ActivePython-2.7.2.5 is
No. It compiles well with this version too.
This time I have not tweaked ActivePython binary files like I did for AP
3.2, I have just enabled Active Python 2.7 in my path while compiling
source.
export PATH=/opt/ActivePython-2.7/bin:$PATH
./configure --prefix=/usr/local/pg93b2 --with-python
make shared_libpython=yes
make shared_libpython=yes install
export PYTHONHOME=/opt/ActivePython-2.7/
export PYTHONPATH=/opt/ActivePython-2.7/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/pg93b2/lib
export LD_LIBRARY_PATH=/opt/ActivePython-2.7/lib:$LD_LIBRARY_PATH
-bash-4.1$ ./psql -p 4444
psql (9.3beta2)
Type "help" for help.
postgres=#
postgres=# create language plpython2u;
CREATE LANGUAGE
By chance if you have missed this part of the PG documentation reading,
then please go through it, it has clear instructions of how you enable
Plpython2 or Plpython3. In particular, the tip section
http://www.postgresql.org/docs/9.3/static/plpython-python23.html
"*Tip:* The built variant depends on which Python version was found during
the installation or which version was explicitly set using the PYTHON
environment
variable; see Section
15.4<http://www.postgresql.org/docs/9.3/static/install-procedure.html>.
To make both variants of PL/Python available in one installation, the
source tree has to be configured and built twice."
[postgres@lix stado]$ psql
psql (9.3beta2)
Type "help" for help.postgres=# create language plpython2u;
ERROR: could not load library
"/opt/PostgreSQL/93b2src/lib/postgresql/plpython2.so":
/opt/PostgreSQL/93b2src/lib/postgresql/plpython2.so: undefined symbol:
PyObject_Bytes
Not certain on the error. Retake the test with above steps you should
succeed.
---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/
Show quoted text
with environment variables as
export PGDATA=/opt/PostgreSQL/pgdata/93b2src
export PYTHONHOME=/opt/ActivePython-2.7
export PYTHONPATH=/opt/ActivePython-2.7/binexport PATH=/opt/PostgreSQL/93b2src/bin:$PYTHONHOME/bin:$PATH
export LD_LIBRARY_PATH=$PYTHONHOME/lib:$LD_LIBRARY_PATH------------------ Original ------------------
*Sender:* "Raghavendra"<raghavendra.rao@enterprisedb.com>;
*Send time:* Tuesday, Jul 16, 2013 4:53 PM
*To:* "guxiaobo1982"<guxiaobo1982@qq.com>; **
*Cc:* "Jov"<amutu@amutu.com>; "Michael Paquier"<michael.paquier@gmail.com>;
"pgsql-general"<pgsql-general@postgresql.org>; "Asif Naeem"<
asif.naeem@enterprisedb.com>; **
*Subject:* Re: Reply: [GENERAL] 回复: [GENERAL] Can't create plpython
languageOn Mon, Jul 15, 2013 at 7:10 PM, guxiaobo1982 <guxiaobo1982@qq.com> wrote:
It works with ActivePython 3.2.2.3,
Thanks for notifying.
but not ActivePython 2.7.2.5.
No idea... :), I tried AP 3.2 with PG 9.2 & PG 9.3B it went fine for me.
---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/------------------ Original ------------------
*From: * "Raghavendra"<raghavendra.rao@enterprisedb.com>;
*Date: * Jul 11, 2013
*To: * "guxiaobo1982"<guxiaobo1982@qq.com>; **
*Cc: * "Jov"<amutu@amutu.com>; "Michael Paquier"<
michael.paquier@gmail.com>; "pgsql-general"<pgsql-general@postgresql.org>;
"Asif Naeem"<asif.naeem@enterprisedb.com>; **
*Subject: * Re: Reply: [GENERAL] 回复: [GENERAL] Can't create plpython
languageOn Wed, Jul 10, 2013 at 7:36 AM, guxiaobo1982 <guxiaobo1982@qq.com>wrote:
I am using PostgreSQL 9.3 beta 2
[postgres@lix Multicorn-master]$ psql
psql (9.3beta2)
Type "help" for help.postgres=#
It does not work with
ActivePython3.2(ActivePython-3.2.2.3-linux-x86_64.tar.gz), Which version of
PostgreSQL are you running?Sorry for being late on this email. I overlooked the version you were
pointing. I didn't test on PG 9.3Beta, I did on PG 9.2 after looking your
error showing PG 9.2.4[postgres@lix PostgreSQL]$ psql
Password:
psql (9.2.4)
Type "help" for help.
postgres=# create language plpython2u;
ERROR: could not access file "$libdir/plpython2": No such file or
directory
postgres=# create language plpython3u;
ERROR: could not access file "$libdir/plpython3": No such file or
directoryLater, I began testing it with PG 9.3beta and encountered same error
message as you have shared here.
Did some analysis and finally succeeded to create language plpython3u
with AP-3.2, however with not many tweaks in compilation.(Steps might be
arguing. Pardon me).Despite the fact that I have ActivePython-3.2 on my system, source
compilation was looking for shared library. Hence compiled explicitly with
shared_libpython=yes.Pre-Steps: (Assuming you have ActivePython 3.2)
cd /opt/ActivePython-3.2/bin/
cp python3.2-config python-config
cp python3. pythonTest:
export PATH=/opt/ActivePython-3.2/bin:$PATH
# which python
/opt/ActivePython-3.2/bin/python
# which python-config
/opt/ActivePython-3.2/bin/python-configSteps:
1. Install PG 9.3 beta with below steps:
export PATH=/opt/ActivePython-3.2/bin:$PATH
./configure --prefix=/usr/local/pg93b3 --with-python
make shared_libpython=yes
make shared_libpython=yes install2. After installation you should see below files in your PG installation
Path:[root@localhost pg93b3]# pwd
/usr/local/pg93b3
[root@localhost pg93b3]# find . | grep python
./lib/postgresql/plpython3.so
./share/postgresql/extension/plpython3u--unpackaged--1.0.sql
./share/postgresql/extension/plpython3u--1.0.sql
./share/postgresql/extension/plpython3u.control3. Now, create new cluster using INITDB
4. Before starting the cluster set the PYTHONHOME, PYTHONPATH,
LD_LIBRARY_PATHexport PYTHONHOME=/opt/ActivePython-3.2/
export PYTHONPATH=/opt/ActivePython-3.2/bin:$PATH
export LD_LIBRARY_PATH=/opt/ActivePython-3.2/lib:$LD_LIBRARY_PATH5. Start the cluster and create the language:
/usr/local/pg93b3/bin/pg_ctl -D /usr/local/pg93b3/data/ start
-bash-4.1$ psql -p 4444
psql (9.3beta1)
Type "help" for help.postgres=# create language plpython3u;
CREATE LANGUAGEOut of my analysis on the issue, Asif Naeem from our Dev group shared his
valuable thoughts to conclude this. Thanks Asif.Question still in mind, Why plpython depends on Shared Libraries (.so) ?
http://www.postgresql.org/docs/9.3/static/install-requirements.html
---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/
On 7/19/2013 12:12 AM, Raghavendra wrote:
... its interesting, why your replies populate as distinct thread
rather than of continuing one
the mailer they are using isn't generating 'In-Reply-To' and/or
'References' headers.
--
john r pierce 37N 122W
somewhere on the middle of the left coast
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Fri, Jul 19, 2013 at 1:30 PM, John R Pierce <pierce@hogranch.com> wrote:
On 7/19/2013 12:12 AM, Raghavendra wrote:
... its interesting, why your replies populate as distinct thread rather
than of continuing onethe mailer they are using isn't generating 'In-Reply-To' and/or
'References' headers.Oh Ok. Thank you for elucidating.
--Raghav