Re: ERROR: ImportError: No module named 'psutil'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Ganesh Korde <ganeshakorde(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: ERROR: ImportError: No module named 'psutil'
Date: 2021-08-01 15:51:03
Message-ID: 1442423.1627833063@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Adrian Klaver 2021-08-01 16:30:12 Re: ERROR: ImportError: No module named 'psutil'
Previous Message Adrian Klaver 2021-08-01 15:35:39 Re: ERROR: ImportError: No module named 'psutil'

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-08-01 16:30:12 Re: ERROR: ImportError: No module named 'psutil'
Previous Message Adrian Klaver 2021-08-01 15:35:39 Re: ERROR: ImportError: No module named 'psutil'