# VTK-Web Server

**URL:** https://discourse.vtk.org/t/vtk-web-server/3497
**Category:** Web
**Created:** [June 9, 2020, 6:11am UTC](https://discourse.vtk.org/t/vtk-web-server/3497 "2020-06-09T06:11:10Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![lopes](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@lopes](https://discourse.vtk.org/u/lopes)
#### Post date: [June 9, 2020, 6:11am UTC](https://discourse.vtk.org/t/vtk-web-server/3497/1 "2020-06-09T06:11:11Z")

</div>

I am attempting to run VTK as a server, following this guide: [http://kitware.github.io/paraviewweb/examples/RemoteRenderer.html#Using-VTK-as-server](http://kitware.github.io/paraviewweb/examples/RemoteRenderer.html#Using-VTK-as-server)

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](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?

Many thanks!

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [June 9, 2020, 8:01am UTC](https://discourse.vtk.org/t/vtk-web-server/3497/2 "2020-06-09T08:01:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [June 9, 2020, 2:51pm UTC](https://discourse.vtk.org/t/vtk-web-server/3497/3 "2020-06-09T14:51:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lopes](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@lopes](https://discourse.vtk.org/u/lopes)
#### Post date: [June 10, 2020, 4:41am UTC](https://discourse.vtk.org/t/vtk-web-server/3497/4 "2020-06-10T04:41:49Z")

</div>

> [@Sebastien\_Jourdain](#):
>
> -D VTK\_GROUP\_ENABLE\_Web=WANT

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?

Edit: I created the build following this documentation: [https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/dev/build.md](https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/dev/build.md) using the settings `DVTK_WHEEL_BUILD=ON -DVTK_WRAP_PYTHON=ON -D VTK_GROUP_ENABLE_Web=WANT`  
and followed the additional steps for python setup.

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.

apologies if im missing something simple.

thanks!

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [June 15, 2020, 11:43am UTC](https://discourse.vtk.org/t/vtk-web-server/3497/5 "2020-06-15T11:43:23Z")

</div>

I’m not sure what is going on as I never tried to build VTK with `VTK_WHEEL_BUILD`. @ben.boeckel do you have some idea of what could be going on?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [June 15, 2020, 11:59am UTC](https://discourse.vtk.org/t/vtk-web-server/3497/6 "2020-06-15T11:59:18Z")

</div>

> [@lopes](#):
>
> 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?)

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?

---

<div class="post-metadata">

### Author: ![lopes](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@lopes](https://discourse.vtk.org/u/lopes)
#### Post date: [June 15, 2020, 10:05pm UTC](https://discourse.vtk.org/t/vtk-web-server/3497/7 "2020-06-15T22:05:45Z")

</div>

Would you be able to provide the exact build cmd you use and the steps to setup python?

---

<div class="post-metadata">

### Author: ![lopes](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/7ab992/32.png) [@lopes](https://discourse.vtk.org/u/lopes)
#### Post date: [June 15, 2020, 10:15pm UTC](https://discourse.vtk.org/t/vtk-web-server/3497/8 "2020-06-15T22:15:25Z")

</div>

> [@ben.boeckel](#):
>
> why not make the build and use `pip install` on it?

It seems to always ignore the Web module when i do this as no web directory is created under the python vtkmodules

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [June 16, 2020, 12:35am UTC](https://discourse.vtk.org/t/vtk-web-server/3497/9 "2020-06-16T00:35:03Z")

</div>

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?
