Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6EDC8133798E for ; Thu, 28 Apr 2011 09:51:47 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 68186-02 for ; Thu, 28 Apr 2011 12:51:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from softlayer.compulab.co.il (50.23.254.54-static.reverse.softlayer.com [50.23.254.54]) by mail.postgresql.org (Postfix) with ESMTP id 4045A1336FA7 for ; Thu, 28 Apr 2011 09:51:39 -0300 (ADT) Received: from [62.90.235.247] (port=45447 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.69) (envelope-from ) id 1QFQh0-00034P-Rc; Thu, 28 Apr 2011 15:51:39 +0300 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 7A6B77E98A9; Thu, 28 Apr 2011 15:51:36 +0300 (IDT) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0ZDirqrMIkOP; Thu, 28 Apr 2011 15:51:33 +0300 (IDT) Received: from [10.1.1.27] (sim-pc.compulab.local [10.1.1.27]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 0312C7E96CF; Thu, 28 Apr 2011 15:51:33 +0300 (IDT) Message-ID: <4DB9624A.1000104@compulab.co.il> Date: Thu, 28 Apr 2011 15:49:14 +0300 From: Sim Zacks User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15pre) Gecko/20110207 Lightning/1.0b2 Shredder/3.1.9pre MIME-Version: 1.0 To: c k CC: "pgsql-general@postgresql.org" Subject: Re: plpython module import errors References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201104/976 X-Sequence-Number: 175332 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