Skip site navigation (1) Skip section navigation (2)

Re: plpython module import errors

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: c k <shreeseva(dot)learning(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpython module import errors
Date: 2011-04-28 12:49:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-adminpgsql-general
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 


In response to


pgsql-admin by date

Next:From: Martin GaintyDate: 2011-04-28 13:15:06
Subject: Re: plpython module import errors
Previous:From: c kDate: 2011-04-28 11:19:08
Subject: plpython module import errors

pgsql-general by date

Next:From: Florian WeimerDate: 2011-04-28 13:08:29
Subject: Re: SSDs with Postgresql?
Previous:From: Erwin BrandstetterDate: 2011-04-28 12:33:55
Subject: Re: timestamp(0) vs. timestamp

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group