Python Script fails to load modules

Hello everyone, I’m doing my thesis with OpenFOAM and I have to use Python-Paraview to plot some results of the simulation I’m doing. As I am pretty new with Python-Paraview coupling I’m not able to solve this problem by myself. Actually I am trying to run the pv_post_processing.py file it was created by other students before me in the terminal (I have a MacOS laptop), and this is the error I obtain:

from paraview.simple import *
Traceback (most recent call last):
File “/Applications/ParaView-5.10.1.app/Contents/Python/paraview/init.py”, line 257, in
from .modules import vtkRemotingCore
ImportError: dlopen(/Applications/ParaView-5.10.1.app/Contents/Python/paraview/modules/vtkRemotingCore.so, 0x0002): Library not loaded: @executable_path/…/Libraries/libvtkRemotingCore-pv5.10.5.10.dylib
Referenced from: /Applications/ParaView-5.10.1.app/Contents/Python/paraview/modules/vtkRemotingCore.so
Reason: tried: ‘/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/…/Libraries/libvtkRemotingCore-pv5.10.5.10.dylib’ (no such file), ‘/usr/local/lib/libvtkRemotingCore-pv5.10.5.10.dylib’ (no such file), ‘/usr/lib/libvtkRemotingCore-pv5.10.5.10.dylib’ (no such file)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “/Applications/ParaView-5.10.1.app/Contents/Python/paraview/init.py”, line 259, in
import _paraview_modules_static
ModuleNotFoundError: No module named ‘_paraview_modules_static’

To make a point regarding that, I am running this thing in a venv with python in it, and it seems that it looks for the libraries in the homebrew directory where python is also installed. Other than that I also specified the python path as follows:

export PYTHONPATH=/Applications/ParaView-5.10.1.app/Contents/Python

Has someone any suggestions regarding this? I am really struggling to find a solution and if someone has any idea it would be really helpful. (Python version=3.9.12, ParaView version=5.10.1)

The application libraries are pinned to the bundle (via @executable_path). You can hack it up by running your executable from ParaView.app/Contents/bin or some other sibling directory.