Consider this python test file main.py
# main.py
from paraview.simple import *
def paraTest():
Cone()
SetProperties(Resolution=32)
Shrink()
Show()
Render()
if __name__ == '__main__':
paraTest()
that depends on paraview
package installed from Anaconda using
conda install -c conda-forge paraview
according to
https://anaconda.org/conda-forge/paraview.
The program works as expected when directly run with python.
The Problem
When I package it using pyinstaller with the Terminal command
pyinstaller main.py
, and then run the executable, I get the following error:
Traceback (most recent call last):
File "paraview/__init__.py", line 161, in <module>
ImportError: Failed to load vtkRemotingCore: No module named paraview.modules.vtkPVVTKExtensionsCore
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 1, in <module>
from paraview.simple import *
File "PyInstaller/loader/pyimod03_importers.py", line 546, in exec_module
File "paraview/__init__.py", line 163, in <module>
ModuleNotFoundError: No module named '_paraview_modules_static'
[14370] Failed to execute script 'main' due to unhandled exception!
My Attempts
I understand there may be some modules not recognized and included by pyinstaller
, so I copied all module files from {miniconda_root}/miniconda3/lib/python3.9/site-packages/paraview/modules
to my package {MyPackage_root}/dist/main/paraview/modules
, but the same error persists.
Environment info
MacOS 11.2 (Big Sur)
python==3.9
paraview==5.9.1
pyinstaller==4.4
Thanks in advance!