How to install pyst3 in FreePBX 17?

I would like to use Python for AGI in FreePBX 17.
To do that, pyst3 python package is needed.
In the past it was possible to run “pip install pyst3”, but in Debian 12 it will end up with “error: externally-managed-environment”

python - How do I solve "error: externally-managed-environment" every time I use pip 3? - Stack Overflow explains the issue

The offer 3 solutions:

  1. pipx - it’s unable to install pyst3
  2. virtual envs - preferred solution, question is - how to use venv with AGI?
  3. override protection. want to avoid this.