# python wheel: How to compile the qt GUI for vtk’s git master version on Ubuntu 20.04.

**URL:** https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529
**Category:** Support
**Created:** [June 12, 2020, 5:57am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529 "2020-06-12T05:57:56Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Hongyi\_Zhao](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hongyi_zhao/32/1695_2.png) [@Hongyi\_Zhao](https://discourse.vtk.org/u/Hongyi_Zhao)
#### Post date: [June 12, 2020, 5:57am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/1 "2020-06-12T05:57:56Z")

</div>

Hi,

I try to compile the qt GUI for vtk’s git master version on Ubuntu 20.04 and use the following option:

```auto
cmake \
  -DCMAKE_INSTALL_PREFIX=/usr/local \
  -DCMAKE_INSTALL_RPATH=/usr/local/lib \
  -DVTK_WHEEL_BUILD=ON \
  -DVTK_WRAP_PYTHON=ON \
  -DVTK_GROUP_ENABLE_Qt:STRING=YES ..
make -j48
python setup.py bdist_wheel
make install

```

But after the installation, I don’t know how to invoking the vtk’s GUI. Any hints for this problem?

Reards

---

<div class="post-metadata">

### Author: ![jcfr](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jcfr/32/466_2.png) [@jcfr](https://discourse.vtk.org/u/jcfr)
#### Post date: [June 12, 2020, 3:56pm UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/2 "2020-06-12T15:56:51Z")

</div>

You could look at [https://github.com/Kitware/VTK/blob/master/Wrapping/Python/vtkmodules/qt/QVTKRenderWindowInteractor.py](https://github.com/Kitware/VTK/blob/master/Wrapping/Python/vtkmodules/qt/QVTKRenderWindowInteractor.py)

There are also examples available here by they are out of date: [https://lorensen.github.io/VTKExamples/site/Python/Widgets/EmbedInPyQt2/](https://lorensen.github.io/VTKExamples/site/Python/Widgets/EmbedInPyQt2/)

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [June 12, 2020, 4:52pm UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/3 "2020-06-12T16:52:02Z")

</div>

If you are using Python, then you do not have to enable Qt when you build VTK. You can use the plain vanilla VTK wheel. The “VTK\_GROUP\_ENABLE\_Qt” setting is only needed if you want to use VTK’s C++ GUI classes, and it is irrelevant to the `QVTKRenderWindowInteractor.py` module that is used from Python.

Please try the following example and let me know if it works for you:  
[TestPyQtInteractor.py](https://discourse.vtk.org/uploads/short-url/fxJus80gLLESiDtquabCrWnqC3.py) (2.4 KB)

---

<div class="post-metadata">

### Author: ![Hongyi\_Zhao](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hongyi_zhao/32/1695_2.png) [@Hongyi\_Zhao](https://discourse.vtk.org/u/Hongyi_Zhao)
#### Post date: [June 14, 2020, 12:16am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/4 "2020-06-14T00:16:53Z")

</div>

I try to run it as following but freeze there:

```auto
$ python ./lib/python3.8/site-packages/vtkmodules/qt/QVTKRenderWindowInteractor.py
PyQt5
^C

```

I use `Ctrl + C` and still cannot kill it.

Regards.

---

<div class="post-metadata">

### Author: ![Hongyi\_Zhao](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hongyi_zhao/32/1695_2.png) [@Hongyi\_Zhao](https://discourse.vtk.org/u/Hongyi_Zhao)
#### Post date: [June 14, 2020, 12:24am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/5 "2020-06-14T00:24:59Z")

</div>

I run this example and it will display a multi-faces cone. But when I scale the GUI with mouse, the GUI fails to response and freezes there. As a result, the system stops to response for all keyboard’s commands and I must reset my computer.

Does this usage of vtk has high requirements for graphics cards or other computer resources?

Regards,  
HY

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [June 14, 2020, 12:36am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/6 "2020-06-14T00:36:49Z")

</div>

There have been some changes in the code between VTK 8.2 and VTK 9. Which version of VTK are you using?

---

<div class="post-metadata">

### Author: ![Hongyi\_Zhao](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hongyi_zhao/32/1695_2.png) [@Hongyi\_Zhao](https://discourse.vtk.org/u/Hongyi_Zhao)
#### Post date: [June 14, 2020, 12:38am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/7 "2020-06-14T00:38:51Z")

</div>

```auto
$ pip list | grep vtk
vtk 9.0.20200612

```

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [June 14, 2020, 1:18am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/8 "2020-06-14T01:18:22Z")

</div>

This is from the wheel that you build yourself? If so, did you build it from VTK 9.0.0, or did get it from one of the git branches (either ‘master’ or ‘release’)?

On my system, with the VTK release branch (will be 9.0.1), I notice that the resizing of the VTK render window is a little bit delayed compared to the resizing of the Qt window for QVTKRenderWindowInteractor.py. I can imagine that this might cause instabilities, depending on the graphics driver (it has nothing to do with VTK’s GL requirements, it implies a bug either in QVTKRenderWindowInteractor.py or in VTK itself). I’m using the amdgpu driver.

Let me try again with the VTK master to see if it also has resizing issues with QVTKRenderWindowInteractor.py.

---

<div class="post-metadata">

### Author: ![Hongyi\_Zhao](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hongyi_zhao/32/1695_2.png) [@Hongyi\_Zhao](https://discourse.vtk.org/u/Hongyi_Zhao)
#### Post date: [June 14, 2020, 1:37am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/9 "2020-06-14T01:37:24Z")

</div>

It’s built on vtk git master branch by me with the following cmake options:

`cmake -DVTK_WHEEL_BUILD=ON -DVTK_WRAP_PYTHON=ON`

Do you compile the gpu support into vtk? I don’t do any gpu relative compilation due that the graphical card for my case is very low-end.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [June 14, 2020, 2:43am UTC](https://discourse.vtk.org/t/python-wheel-how-to-compile-the-qt-gui-for-vtk-s-git-master-version-on-ubuntu-20-04/3529/10 "2020-06-14T02:43:33Z")

</div>

The VTK build automatically links to the libOpenGL that exists on your system, and as far as I understand, libOpenGL automatically uses the GPU drivers that are installed. So, no, I did not do any GPU-specific configuration when I built VTK. It just uses my GPU automatically, via libOpenGL.

In any case, when I update to the VTK master branch (specifically, commit 06c1830867) I can reproduce the freeze. I have to resize the window a lot before the freeze occurs (around 30 seconds or so of continuous resizing), but I can definitely reproduce it. I didn’t see this in the release branch, but maybe I didn’t try hard enough.

I’ll look into this a bit deeper and get back to you (might take a while).
