Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mADk8-0001ud-8z for pgsql-general@arkaria.postgresql.org; Sun, 01 Aug 2021 15:51:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mADk6-0002zW-Vy for pgsql-general@arkaria.postgresql.org; Sun, 01 Aug 2021 15:51:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mADk6-0002zO-N5 for pgsql-general@lists.postgresql.org; Sun, 01 Aug 2021 15:51:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mADk4-0006Cl-KO for pgsql-general@lists.postgresql.org; Sun, 01 Aug 2021 15:51:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 171Fp3qI1442424; Sun, 1 Aug 2021 11:51:03 -0400 From: Tom Lane To: Adrian Klaver cc: Ganesh Korde , pgsql-general Subject: Re: ERROR: ImportError: No module named 'psutil' In-reply-to: <113c9dee-7126-79f3-0c78-03ecbba89f0b@aklaver.com> References: <113c9dee-7126-79f3-0c78-03ecbba89f0b@aklaver.com> Comments: In-reply-to Adrian Klaver message dated "Sun, 01 Aug 2021 08:35:39 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1442422.1627833063.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 01 Aug 2021 11:51:03 -0400 Message-ID: <1442423.1627833063@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Adrian Klaver 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 "", line 1, in 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