I keep receiving the following error:
File “vtk_server.py”, line 33, in
from vtk.web import protocols
File “C:\Users…\AppData\Local\Programs\Python\Python36\lib\site-packages\vtkmodules\web\protocols.py”, line 10, in
from vtk.vtkWebCore import vtkWebApplication, vtkWebInteractionEvent
ImportError: cannot import name ‘vtkWebApplication’
The vtk repo doesn’t seem to contain a vtkWebCore module so i’ve assumed that this folder is the module and added it to my vtkmodules directory: https://github.com/Kitware/VTK/tree/master/Web/Core
Is this correct?
If so, the vtkWebApplication file is c++ and doesn’t seem to have a python wrapper to call it.?
Could someone please help me understand how to get vtk running as a server and on the web?
All of what you said is mostly correct. I think the module got wrapped but the issue that you are running into is related to some code refactoring in VTK that changed the way it should be imported.
Actually after trying, I run into similar issue. The web module was not turned ON by default.
By doing so, I was able to make things work with the same import line.
You need to do -D VTK_GROUP_ENABLE_Web=WANT to get that module properly produced.
Thanks for the response Sebastien! I’ve installed vtk python via the cmd “pip install vtk”. Where would i input the -D VTK_GROUP_ENABLE_Web=WANT option?
I added the generated python build files to my python C:\Users.…\AppData\Local\Programs\Python\Python36\Lib\site-packages directory (not sure if this step is correct?)
I’m getting the following error now:
Traceback (most recent call last):
File "vtk_server.py", line 33, in <module>
from vtk.web import protocols
File "C:\Users\amylo\AppData\Local\Programs\Python\Python36\lib\site-packages\vtkmodules\web\protocols.py", line 10, in <module>
from vtk.vtkWebCore import vtkWebApplication, vtkWebInteractionEvent
ModuleNotFoundError: No module named 'vtk.vtkWebCore'
The only vtkWebCore file i have is vtkWebCore.cp37-win_amd64.pyd (python extension module) file but it doesn’t seem to recognise it. the Core folder i mentioned earlier didnt get created and if i do the same process of adding it in manually i get the same error as before.
Did you just copy them? That’s certainly not supported unless you do exactly what the wheel does. If you’re specifying a wheel build, why not make the build and use pip install on it?
If you have a build with the wheel flag set and enable the Web modules, it should package them up. If not, where are the Web modules in the build tree in relation to the other moduels that the glob isn’t finding them?