From: Sim Zacks <sim@compulab.co.il>
To: c k <shreeseva.learning@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: plpython module import errors
Date: Thu, 28 Apr 2011 15:49:14 +0300
Message-ID: <4DB9624A.1000104@compulab.co.il> (raw)
In-Reply-To: <BANLkTikG=d4n2tvVH0+aBTyHJtwC=fgFqw@mail.gmail.com>
References: <BANLkTikG=d4n2tvVH0+aBTyHJtwC=fgFqw@mail.gmail.com>
On 04/28/2011 02:19 PM, c k wrote:
> Hello,
> I have installed postgresql 9 on fedora 14 having python 2.7. Now
> created plpythonu language in my database and created a simple
> function to calculate sum of two variables.
> while importing math libbrary and executing the function i got the error
> PL/Python: ImportError: No module named cmath
>
> tried to search help for this error on net and tried various things
> but nothing solved this.
> What can I do to solve this error.
> I can still work from python interpreter directly.
> Thanks in advcance.
> C P Kulkarni
This can happen if you have more then one version of python on the
server and the postgresql is using a different one then you do on the
command line. This is becuase modules are installed per version of python.
The easiest way to check this is:
create or replace function pyver() returns text as
$$
import sys
return sys.version
$$ language 'plpythonu';
select pyver()
and see if the version it returns is the same one as when you open the
interpreter.
Sim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: sim@compulab.co.il, shreeseva.learning@gmail.com, pgsql-general@postgresql.org
Subject: Re: plpython module import errors
In-Reply-To: <4DB9624A.1000104@compulab.co.il>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox