Install any python package question

@mwestphal
I created the virtual environment successfully with pvpython:

./pvpython -m venv .venv

But when I open the site packages directory (.venv/lib/python3.10/site-packages/), I do not see the actual Python packages that come pre-installed with ParaView:

pvpython -c '
from pathlib import Path
import site
site_packages = site.getsitepackages()[0]
for package in Path(site_packages).iterdir():
    print(package.stem)
'

On the other hand, the Python executable in the virtual environment (.venv/bin/python) can correctly import the external packages, such as NumPy.

How can I get the actual site-packages directory of ParaView from within .venv?

pvpython --venv .venv 
pvbatch --venv .venv
paraview --venv .venv

This is to tell ParaView/pvpython/pvbatch to use the given virtual environment. What I would like to achieve is that the Python interpreter of the virtual environment created by

./pvpython -m venv .venv

knows about the installed packages. Because it doesn’t. When I launch that interpreter (.venv/bin/python) and execute

from pathlib import Path
import site
site_packages = site.getsitepackages()[0]
for package in Path(site_packages).iterdir():
    print(package.stem)

it prints

pip
pkg_resources
distutils-precedence
setuptools
_distutils_hack
setuptools-65.5.0
pip-23.0.1

which is far from all the packages that ParaView ships.

To use a venv with ParaView in it, you just need to set the PYTHONPATH and LD_LIBRARY_PATH (linux) environment variable.

What was discussed before was to use the venv to pip install things and have those things available inside ParaView Qt or ParaView Python shell.