pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Ganesh Korde <ganeshakorde@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: ERROR: ImportError: No module named 'psutil'
Date: Sun, 01 Aug 2021 11:51:03 -0400
Message-ID: <1442423.1627833063@sss.pgh.pa.us> (raw)
In-Reply-To: <113c9dee-7126-79f3-0c78-03ecbba89f0b@aklaver.com>
References: <CAPNyb0UKUn_RwvD+jtmo27CqPzrOa3Ae+JuzCcWwnNXvnwPMSg@mail.gmail.com>
	<CAPNyb0X=vq55ZWNuK1n+gfhPLy+J8KDn9XXcONKj30iZPYi+Kw@mail.gmail.com>
	<113c9dee-7126-79f3-0c78-03ecbba89f0b@aklaver.com>

Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 8/1/21 7:40 AM, Ganesh Korde wrote:
>> I am trying to run a python function using the language plpython3u and 
>> I am getting the below error, though I have installed psutil.
>> 
>> postgres=# select * from get_psutil_mem();
>> ERROR:  ImportError: No module named 'psutil'

> How did you install plpython3u?
> How did you install psutil?

Experimenting locally, I observe something that seems relevant:
I get that error message phrasing from python *2*.  In python 3,
an unknown module name draws "ModuleNotFoundError":

$ python3
Python 3.6.8 (default, Mar 18 2021, 08:58:41) 
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from z import virtual_memory, swap_memory
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'z'

Now it's possible that the wording didn't change exactly at the 2/3
boundary, but I doubt it.  So it looks to me like the alleged plpython3u
language is actually invoking python 2.something, which is unlikely
to work well at all.

			regards, tom lane





view thread (7+ messages)  latest in thread

Message-ID: <1442423.1627833063@sss.pgh.pa.us>
Permalink:  ../1442423.1627833063@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1442423.1627833063@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com, ganeshakorde@gmail.com, pgsql-general@lists.postgresql.org
  Subject: Re: ERROR: ImportError: No module named 'psutil'
  In-Reply-To: <1442423.1627833063@sss.pgh.pa.us>

* 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