Error: Cannot import vtkPVAnimation while building ParaView with python 3

(Shailesh Bg) #1

Hello,

I have been at this issue for quite some time now. But still, I am not getting a way to successfully build ParaView with python3.
I followed the documentation at https://github.com/Kitware/ParaView/blob/master/Documentation/dev/build.md

This is my cmake command:
cmake -GNinja ../ -DPARAVIEW_BUILD_QT_GUI=OFF -DPARAVIEW_USE_MPI=ON -DPARAVIEW_ENABLE_PYTHON=ON -DPARAVIEW_ENABLE_WEB=ON -DPARAVIEW_BUILD_ALL_MODULES=OFF -DPARAVIEW_USE_MPI_SSEND=ON -DPARAVIEW_USE_ICE_T=ON -DPARAVIEW_USE_QTHELP=OFF -DENABLE_osmesa:BOOL=ON -DENABLE_qt5:BOOL=OFF -DENABLE_ffmpeg:BOOL=ON`

After building I get this error:
`Error: Cannot import vtkPVAnimation’

I require vtkPVAnimation because I am using GetAnimationScene() and UpdateAnimationUsingDataTimeSteps() functions, after using LegacyVTKReader to load vtk data from openFoam simulation.

To check if the files have been built, I did a diff between the vtkmodules in the python2.7 built official binary and the vtkmodules which I have built. I found that my build has these many files missing. Here . represents the vtkmodules drectory of the official binaries

`Only in .: vtkPVAnimation.py
Only in .: vtkPVAnimationPython.so
Only in .: vtkPVCatalyst.py
Only in .: vtkPVCatalystPython.so
Only in .: vtkPVClientServerCoreCore.py
Only in .: vtkPVClientServerCoreCorePython.so
Only in .: vtkPVClientServerCoreDefault.py
Only in .: vtkPVClientServerCoreDefaultPython.so
Only in .: vtkPVClientServerCoreRendering.py
Only in .: vtkPVClientServerCoreRenderingPython.so
Only in .: vtkPVCommon.py
Only in .: vtkPVCommonPython.so
Only in .: vtkPVPythonAlgorithm.py
Only in .: vtkPVPythonAlgorithmPython.so
Only in .: vtkPVPythonCatalystPython.so
Only in .: vtkPVServerImplementationCore.py
Only in .: vtkPVServerImplementationCorePython.so
Only in .: vtkPVServerImplementationRendering.py
Only in .: vtkPVServerImplementationRenderingPython.so
Only in .: vtkPVServerManagerApplication.py
Only in .: vtkPVServerManagerApplicationPython.so
Only in .: vtkPVServerManagerCore.py
Only in .: vtkPVServerManagerCorePython.so
Only in .: vtkPVServerManagerDefault.py
Only in .: vtkPVServerManagerDefaultPython.so
Only in .: vtkPVServerManagerRendering.py
Only in .: vtkPVServerManagerRenderingPython.so
Only in .: vtkParaViewWebCore.py
Only in .: vtkClientServer.py
Only in .: vtkClientServerPython.so
Only in .: vtkPythonInterpreter.py
Only in .: vtkPythonInterpreterPython.so
Only in .: vtkRenderingParallelLIC.py
Only in .: vtkRenderingParallelLICPython.so’

And many other files which I have explicitly switched off in my build as I do not require them (like vtk extensions.)

I have been playing around with many build options, which I thought was related to this, but to no use.
Could you please let me know which build setting I have to enable so that vtkPVAnimation is built in this setting. Any suggestion would be greatly appreciated.

Regards,
Shailesh

(Utkarsh Ayachit) #2

This is a indeed a bug (if you’re using master branch) reported here. Fix is this available in this merge-request.

(Shailesh Bg) #3

Hi,

Thank you for your reply. I tried cloning the master branch which has already been merged with the changes, but I got the same error. So I cloned paraview version 5.5.2 and tried building it. This is my cmake command:
sudo cmake -GNinja …/ -DPARAVIEW_BUILD_QT_GUI=OFF -DPARAVIEW_USE_MPI=ON -DPARAVIEW_ENABLE_PYTHON=ON -DPYTHON_LIBRARY=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5.so -DPYTHON_INCLUDE_DIR=/usr/include/python3.5 -DPYTHON_EXECUTABLE=/usr/bin/python3.5 -DPARAVIEW_ENABLE_WEB=ON -DPARAVIEW_USE_MPI_SSEND=ON -DPARAVIEW_USE_QTHELP=OFF

But I get a new error now:
[Fri May 10 06:52:42.833563 2019] [mpm_event:notice] [pid 1:tid 139991330047872] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.6.5 Python/3.6 configured – resuming normal operations
[Fri May 10 06:52:42.833671 2019] [core:notice] [pid 1:tid 139991330047872] AH00094: Command line: ‘apache2 (mod_wsgi-express) -f /tmp/mod_wsgi-localhost:9090:999/httpd.conf -D MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D FOREGROUND’
[Fri May 10 06:52:45.291944 2019] [wsgi:error] [pid 164:tid 139991330047872] Error: Cannot import vtkPVServerManagerApplication
[Fri May 10 06:52:45.343722 2019] [wsgi:error] [pid 164:tid 139991330047872] mod_wsgi (pid=164): Failed to exec Python script file ‘/tmp/mod_wsgi-localhost:9090:999/handler.wsgi’.
[Fri May 10 06:52:45.343793 2019] [wsgi:error] [pid 164:tid 139991330047872] mod_wsgi (pid=164): Exception occurred processing WSGI script ‘/tmp/mod_wsgi-localhost:9090:999/handler.wsgi’.
[Fri May 10 06:52:45.348229 2019] [wsgi:error] [pid 164:tid 139991330047872] Traceback (most recent call last):
[Fri May 10 06:52:45.348286 2019] [wsgi:error] [pid 164:tid 139991330047872] File “/tmp/mod_wsgi-localhost:9090:999/handler.wsgi”, line 94, in
[Fri May 10 06:52:45.348292 2019] [wsgi:error] [pid 164:tid 139991330047872] recorder_directory=recorder_directory)
[Fri May 10 06:52:45.348300 2019] [wsgi:error] [pid 164:tid 139991330047872] File “/usr/local/lib/python3.6/dist-packages/mod_wsgi/server/init.py”, line 1415, in init
[Fri May 10 06:52:45.348305 2019] [wsgi:error] [pid 164:tid 139991330047872] exec(code, self.module.dict)
[Fri May 10 06:52:45.348311 2019] [wsgi:error] [pid 164:tid 139991330047872] File “/postProcess_app/postProcessing_flask.wsgi”, line 9, in
[Fri May 10 06:52:45.348316 2019] [wsgi:error] [pid 164:tid 139991330047872] from postProcessing_flask import app as application
[Fri May 10 06:52:45.348325 2019] [wsgi:error] [pid 164:tid 139991330047872] File “/postProcess_app/postProcessing_flask.py”, line 4, in
[Fri May 10 06:52:45.348330 2019] [wsgi:error] [pid 164:tid 139991330047872] from postProcessing import call_paraview
[Fri May 10 06:52:45.348336 2019] [wsgi:error] [pid 164:tid 139991330047872] File “/postProcess_app/postProcessing.py”, line 7, in
[Fri May 10 06:52:45.348340 2019] [wsgi:error] [pid 164:tid 139991330047872] from paraview.simple import *
[Fri May 10 06:52:45.348347 2019] [wsgi:error] [pid 164:tid 139991330047872] File “/postProcess_app/paraview/build/lib/python3.5/site-packages/paraview/simple.py”, line 41, in
[Fri May 10 06:52:45.348351 2019] [wsgi:error] [pid 164:tid 139991330047872] from paraview import servermanager
[Fri May 10 06:52:45.348358 2019] [wsgi:error] [pid 164:tid 139991330047872] File “/postProcess_app/paraview/build/lib/python3.5/site-packages/paraview/servermanager.py”, line 3161, in
[Fri May 10 06:52:45.348362 2019] [wsgi:error] [pid 164:tid 139991330047872] vtkInitializationHelper.Initialize(sys.executable,
[Fri May 10 06:52:45.348384 2019] [wsgi:error] [pid 164:tid 139991330047872] NameError: name ‘vtkInitializationHelper’ is not defined

Could you please help me in figuring this out, any suggestions would be greatly appreciated.

Regards,
Shailesh

(Utkarsh Ayachit) #4

I can’t remember if ParaView 5.5.2 supported Python 3 esp. (cc: @jourdain)

What was the command line you’re using for master build? I can try to see if I can reproduce it locally.

(Shailesh Bg) #5

Hi,

Thank you for your reply. I was able to build the binaries with ParaView 5.5.2 on python 3.6.8

I would like to open source this binary, what would you suggest as the best way to do that?

Regards,
Shailesh

(Mathieu Westphal (Kitware)) #6

What do you mean ? ParaView is an open source software.

(Shailesh Bg) #7

Hi,

I meant I would like to contribute by sharing this binary. So that it might help someone looking for ParaView binaries built on python3. What is the best way in which I can do that?

Regards,
Shailesh

(Mathieu Westphal (Kitware)) #8

This binary has been built on your system and is only compatible with your system, so sharing it would not be possible. We work around that in our release by using the paraview-superbuild.

In any case, upgrading to python3 in the release is on our to-do list, so it should be available at some point in the future.

Thanks for the willingness to share. If you are interested to contribute to ParaView, please, keep using ParaView, report any issue you may encounter and even try to fix issues that you care about. :grinning: