Trame with custom vtkmodules library

Hello all,

I’m trying to use trame with a custom vtk python build (which adds a module that exposes an interface to an external library). Everything seems to work fine regarding the custom python extensions. However, when calling 04_application/solution.py I get the following error:

VTK is not available inside your Python environment
Traceback (most recent call last):
File “C:\Users\Tester\trame-tutorial\04_application\solution3.py”, line 609, in
view = vtk.VtkRemoteLocalView(
File “C:\Python310\lib\site-packages\trame_vtk\widgets\vtk\common.py”, line 380, in init
self.server.state[self._view_key_id] = MODULE.id(view)
File "C:\Python310\lib\site-packages\trame_vtk\modules\vtk_init
.py", line 175, in id
return HELPER.id(vtk_obj)
AttributeError: ‘NoneType’ object has no attribute ‘id’

Here I didn’t use a venv since I have a minimal env setted up. So I guess, I’m not compiling some of the required modules for Trame.vtk? Is there any minimal module compilations, vtk side, required for trame.vtk (I compile only these vtk mods that I require)? Should I probably compile the wheel and install those instead… I guess nothing would change though… Let me know if you have any suggestions.

Many thanks in advance!

With your VTK you need to enable the Web module. That should allow you to do import vtk.web.

Thanks ! I’m marking it as solution!

1 Like