The ParaView binary release (from https://paraview.org/download) is great as it is an very easy way to install and use ParaView.
However it has one big limitation, is that it contains a set number of python packages without an obvious way to augment that set.
Indeed, installing python packages locally will not work unless your local python is the exact same version as the one used by ParaView. Not everyone has the possiblity to install a specific version of python on their computer just for ParaView.
But, to be fair, ParaView does not need your system python to be the same, it only needs the installed python package to be compatible with the right version of python!
And it so happens that pip
does support installing package for other versions of python.
With that in mind, we can consider the local Python and pip to be just a package manager used to install packages that ParaView can use.
Here is a concrete example.
- Download ParaView 5.12.0 binary release archive from https://paraview.org/download
- Extract it and run ParaView
- Help → About → Note the “Python Libary Version” : 3.10.13
- Alternatively, run
./bin/pvpython -c "import sys; print(sys.version)"
- Install packages (here I’m installing
pytest
) in a dedicated directory
mkdir /path/to/paraview_5120_python_packages
python3 -m pip install --only-binary=:all: --python-version 3.10.13 --target paraview_5120_python_packages/ pytest pytest-cov exceptiongroup
- Run ParaView with
PYTHONPATH
set correctly, you can now importpytest
!
PYTHONPATH=path/to/paraview_5120_python_packages/ ./bin/pvpython
> import pytest