Personal tools
You are here: Home Forum Install & build 9.2.0 vtk environment

9.2.0 vtk environment

Up to Install & build

9.2.0 vtk environment

Posted by Benoit Chaigne at January 15. 2019

When trying to access the vtkRenderer via libSalomePy (GUI module) I have the following error:

>>> import libSalomePy

>>> libSalomePy.getRenderer()

ImportError: No module named 'vtkRenderingCorePython'

 

p, li { white-space: pre-wrap; }

I noticed that the vtk environment in the salome launch script contains a bad folder:

context.addToPythonPath(r"${PVHOME}/lib/paraview-5.6/site-packages/vtk")

It should be:

context.addToPythonPath(r"${PVHOME}/lib/paraview-5.6/site-packages/vtkmodules")

I guess this path takes its definition from PROJECT/products/env_scripts/ParaView.py:

env.prepend('PYTHONPATH', os.path.join(paralib, 'site-packages', 'vtk'))

where it should be

env.prepend('PYTHONPATH', os.path.join(paralib, 'site-packages', 'vtkmodules'))

 

NB : I'm using the Debian 9 binary version

 

Re: 9.2.0 vtk environment

Posted by Vadim SANDLER at January 15. 2019

Hello Benoit,

Thank you for reporting this issue.

In fact, this line in config file is deprecated, and has to be omitted. However, you're right, there is a problem in SALOME 9.2 with accessing vtk wrappers (renderer, etc) from libSalomePy Python module. This is due a bug in libSalomePy implementation.

This bug has been fixed, see https://git.salome-platform.org/gitweb/?p=modules/gui.git;a=commit;h=e70f3c39 .

Meantime, the solution you described can be used as a temporary workaround.

Regards,
Vadim.

Re: 9.2.0 vtk environment

Posted by Andrey Krylov at January 21. 2021

Hello Vadim,

The bug appeared again and libSalomePy.getRenderer is broken in SALOME 9.5 and 9.6. Temporary workaround is a file named vtkRenderingCorePython.py in folder BINARIES-*/ParaView/lib/python3.6/site-packages/vtkmodules/ containing:
from .vtkRenderingCore import *

(see attachment)

The following trivial change is needed to fix the issue. Line 121 in gui/src/SALOME_PY/SalomePy.cxx :
aVTKModule = PyImport_ImportModule( "vtk.vtkRenderingCorePython" );
should read
aVTKModule = PyImport_ImportModule( "vtk.vtkRenderingCore" );

It would be great to have a small test case to prevent such regressions in the future.

Something as short as:
import libSalomePy;libSalomePy.getRenderer(0)

Attachments

Re: 9.2.0 vtk environment

Posted by Vadim SANDLER at January 21. 2021

Hello Andrey,

Thank you for reporting this problem. I have fixed it, see this commit:
https://git.salome-platform.org/gitweb/?p=modules/gui.git;a=commit;h=f5e9fedd

The correction will be available with the next SALOME release.

Regards,
Vadim.

Powered by Ploneboard
Document Actions