pythondatabasepostgresqlpython-venvplpython

Use virtual environment for plpython3u in PostgreSQL


I'm trying to use packages from an existing virtual environment within the plpython3u extension for PostgreSQL. I found and followed this tutorial, but it didn't work.

Firstly, the configuration file for my installation is named and looks different than described in the tutorial, and when I tried to do the server-wide config the database wouldn't start anymore. In the tutorial, they used version 14, but I'm on 15.

Secondly, for the per-sessions configuration, the provided code simply didn't work.

Does anyone have experiences or any pointers for me on how to set this up?


Solution

  • Found a solution for the per-session config: use virtualenv to create the venv instead of doing it with Python itself. The latter doesn't create the "activate_this.py"-file which is used in the tutorial for activating the venv. That's why it failed for me.