how to download modules to use with plpython postgresql

48 Views Asked by At

I'm trying to use plpython3u with postgresql on windows 11, and I want to use the requests library to make http requests.. So I did this test function:

CREATE OR REPLACE FUNCTION teste()
   RETURNS TEXT
AS $$
    import requests
    
    return '10'
$$ LANGUAGE plpython3u;

I can install the plpython3u extension successfully, this function is also created successfully, but when trying to select this function I receive this error:

ERROR: ModuleNotFoundError: No module named 'requests'
  Onde: Traceback (most recent call last):
  PL/Python function "teste", line 2, in <module>
    import requests
função PL/Python "teste"

It's saying that my requests module is not available. postgresql I get this error, can anyone help me with how I can download the requests package to use in my plpython3u function?

I tried running pip3 install requests --force in this path: C:\Program Files\PostgreSQL\15\pgAdmin 4\python

and apparently the requests package was installed, but when trying to run the function I showed above, the same error persists.

for more context: I installed plpython3u using the edb stack builder/language packages (all the correct environment variables are installed, so much so that simple plpython functions run in my database, except the import request)

I ran the pip3.exe install requests command in my directory: C:\edb\languagepack\v4\Python-3.11\Scripts, and I received an error

Falha na execução do programa 'pip3.exe': O executável especificado não é um aplicativo válido para esta plataforma de

SO.No linha:1 caractere:1

  • pip3 install requests

No linha:1 caractere:1

  • pip3 install requests
  •   + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
      + FullyQualifiedErrorId : NativeCommandFailed
    
    
    

Furthermore, I still cannot use the requests package in my plpython3u function because the error already mentioned at the beginning of the question occurs

0

There are 0 best solutions below