Обсуждение: =?gb18030?B?UmVwbHk6IFtHRU5FUkFMXSC72Li0o7ogW0dFTkVS?= =?gb18030?B?QUxdIENhbid0IGNyZWF0ZSBwbHB5dGhvbiBsYW5n?= =?gb18030?B?dWFnZQ==?=

Поиск
Список
Период
Сортировка
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?

Regards,

Xiaobo Gu


------------------ Original ------------------
Sender: "Raghavendra"<raghavendra.rao@enterprisedb.com>;
Send time: Tuesday, Jul 9, 2013 8:00 PM
To: "guxiaobo1982"<guxiaobo1982@qq.com>;
Cc: "Jov"<amutu@amutu.com>; "Michael Paquier"<michael.paquier@gmail.com>; "pgsql-general"<pgsql-general@postgresql.org>;
Subject: Re: [GENERAL] 回复: [GENERAL] Can't create plpython language


[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
postgres=# \q

There are python 2.4.3 and python3.2 on the same machine,.

I tried to create it using ActivePython3.2. It worked.

Stop the running postgresql cluster and set the ActivePython3.2 path as below.

export PYTHONPATH=/opt/ActivePython-3.2/bin:$PATH
export PYTHONHOME=/opt/ActivePython-3.2/
export LD_LIBRARY_PATH=/opt/ActivePython-3.2/lib/

Now start the postgresql cluster and try creating the language;

-bash-4.1$ psql
psql.bin (9.2.3)
Type "help" for help.

postgres=# create language plpython3u;
CREATE LANGUAGE
postgres=#

---
Regards,
Raghavendra
EnterpriseDB Corporation

 
------------------ 原始邮件 ------------------
发件人: "Jov"<amutu@amutu.com>;
发送时间: 2013年7月5日(星期五) 上午7:59
收件人: "Michael Paquier"<michael.paquier@gmail.com>;
抄送: ""<guxiaobo1982@qq.com>; "pgsql-general"<pgsql-general@postgresql.org>;
主题: Re: [GENERAL] Can't create plpython language

try the postgresql official rpm package for centos 5:
http://yum.postgresql.org/9.2/redhat/rhel-5-x86_64/pgdg-centos92-9.2-6.noarch.rpm

or build your own from source.



2013/7/5 Michael Paquier <michael.paquier@gmail.com>
On Thu, Jul 4, 2013 at 6:26 PM, guxiaobo1982 <guxiaobo1982@qq.com> wrote:
> Hi,
>
> I am running PostgreSQL 9.2.4.1 (from EnterpriseDB) on CENTOS 5.9 X64
> server, I got the following errors when trying to create the python language
> handler, can you help with this, thanks in advance.
If this is PPAS, as the version number would suggest, you should
directly ask this question to EDB support team. This problem might not
be related to Postgres itself... At least the buildfarm machines do
not crash when trying to install a plpython extension.
--
Michael


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: Reply: [GENERAL] 回复: [GENERAL] Can't create plpython language

От
Raghavendra
Дата:
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) ?


---
Regards,
Raghavendra
EnterpriseDB Corporation