pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Gainty <mgainty@hotmail.com>
To: sim@compulab.co.il
To: shreeseva.learning@gmail.com
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: plpython module import errors
Date: Thu, 28 Apr 2011 09:15:06 -0400
Message-ID: <BLU142-W36C9DEBBD6746ECBFCA840AE9B0@phx.gbl> (raw)
In-Reply-To: <4DB9624A.1000104@compulab.co.il>
References: <BANLkTikG=d4n2tvVH0+aBTyHJtwC=fgFqw@mail.gmail.com>
	<4DB9624A.1000104@compulab.co.il>


you will have to compensate for python's version-i*i*t*c behaviour by naming the binary to the exact version of python you are calling e.g.
mv python python5 (for python version 5 binary)
mv python python6 (for python version 6 binary)

then in each of the bash scripts you are calling reference python5 or python6 the correct version
you can also setup an alias in the .bashrc to point to the 'right version'

*friends dont let friends code in python*
Martin 
______________________________________________ 
Note de déni et de confidentialité
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Thu, 28 Apr 2011 15:49:14 +0300
> From: sim@compulab.co.il
> To: shreeseva.learning@gmail.com
> CC: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] plpython module import errors
> 
> 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
> 
> -- 
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
 		 	   		  =

view thread (8+ messages)  latest in thread

Message-ID: <BLU142-W36C9DEBBD6746ECBFCA840AE9B0@phx.gbl>
Permalink:  ../BLU142-W36C9DEBBD6746ECBFCA840AE9B0@phx.gbl/
Also on:    postgresql.org/message-id/BLU142-W36C9DEBBD6746ECBFCA840AE9B0@phx.gbl

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mgainty@hotmail.com, sim@compulab.co.il, shreeseva.learning@gmail.com, pgsql-general@postgresql.org
  Subject: Re: plpython module import errors
  In-Reply-To: <BLU142-W36C9DEBBD6746ECBFCA840AE9B0@phx.gbl>
  References: <BANLkTikG=d4n2tvVH0+aBTyHJtwC=fgFqw@mail.gmail.com> <4DB9624A.1000104@compulab.co.il> <BLU142-W36C9DEBBD6746ECBFCA840AE9B0@phx.gbl>

* 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