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!
There are three solutions, we recommen uv
.
uv
+ venv
solution
And it so happens that uv
support natively installing package in any virtual environement, and ParaView is able to generate a venv!
Here is how to do it with any version of ParaView >= 5.13.3
- install
uv
- Download ParaView binary release archive from https://paraview.org/download
- Extract it and
cd
into it. ./bin/pvpython -m venv ./.venv
VIRTUAL_ENV=./.venv/ uv pip install pytest pytest-cov exceptiongroup
- Run ParaView with
./bin/paraview --venv .venv
- Open Python Shell, you can import pytest:
import pytest
pip
+ venv
solution
With the addition of the --venv
arg to ParaView (available starting in ParaView 5.13), it becomes simpler to deploy that workflow, here is a concrete example.
- Download ParaView 5.13.3 binary release archive from https://paraview.org/download
- Extract it and
cd
to it - run
./bin/pvpython -m venv .venv
- run
./bin/pvpython -c "import sys; print(sys.version)"
- Install packages (here I’m installing
pytest
) in the directory right in the venv
python3 -m pip install --only-binary=:all: --python-version 3.12.7 --target ./.venv/lib/python3.12/site-packages/ pytest pytest-cov exceptiongroup
- Run ParaView with
./bin/paraview --venv .venv
- Open Python Shell, you can import pytest:
import pytest
pip only solution
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.
- install any version of Python with
pip
- 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