# Vtk python does not import on today's windows nightly

**URL:** <https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868>\
**Category:** Development\
**Tags:** qt\
**Created:** [January 18, 2018, 2:05pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868 "2018-01-18T14:05:43Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 18, 2018, 2:05pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/1 "2018-01-18T14:05:43Z")

</div>

Today’s nightly windows Slicer starts, but all scripted modules are broken. Today’s nightly on mac works fine for me, as does 4.8.1 on the same windows machine.

The first error message is:

```auto
>>> import vtk
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named vtk

```

probably a vtk9 packaging issue.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 18, 2018, 2:33pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/2 "2018-01-18T14:33:37Z")

</div>

Since nothing was expected to change for the current nightly, I suspect [r26834](http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26834) introduced the regression.

Cc: @adamrankin

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 18, 2018, 2:39pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/3 "2018-01-18T14:39:38Z")

</div>

I had the same issue and could fix it locally by modifying SlicerLauncherSettings.ini. I had to add VTK Python packages location `<APPLAUNCHER_DIR>/bin/Lib/site-packages` to section `[PYTHONPATH]`. It would be great if somebody could fix the ini file generation.

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [January 18, 2018, 2:49pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/4 "2018-01-18T14:49:29Z")

</div>

This is beyond my level of knowledge. If Andras’ fix is the correct one, I can implement the change.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 18, 2018, 3:25pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/5 "2018-01-18T15:25:06Z")

</div>

I’m not sure if the correct solution is to add/change paths in launcher settings (by changing External\_VTKv9.cmake) or change VTK configuration to deploy site-packages to a different folder.

@jcfr Could you advise?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 18, 2018, 3:27pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/6 "2018-01-18T15:27:41Z")

</div>

I can confirm the fix from Andras works. The SlicerLauncherSettings.ini file is in the bin directory and in addition to adding the line `12\path=<APPLAUNCHER_DIR>/bin/Lib/site-packages` you need to increment the last line of the section to `size=12`.

Other notes: the nightly crashes when started over remote desktop but the 4.8.1 release does not (probably the OpenGL2 issue) and I see the same [slowdown in Slice rendering that Andras reported](https://issues.slicer.org/view.php?id=4496).

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 18, 2018, 3:32pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/7 "2018-01-18T15:32:47Z")

</div>

> [@pieper](#):
>
> Today’s nightly windows Slicer starts, but all scripted modules are broken

@pieper Look like you meant “building the current trunk with Qt5 and VTK9 enabled” ? (there is no `bin/Lib/site-packages` directory in the current nightly windows package)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 18, 2018, 3:36pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/8 "2018-01-18T15:36:30Z")

</div>

@jcfr I just downloaded and installed 4.9.0-2018-01-17 and I have a bin/Lib/site-packages:

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/c/7c71fc45907c639db54b2183972d0f343742cd3b.png)

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [January 23, 2018, 4:44pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/9 "2018-01-23T16:44:28Z")

</div>

9 posts were merged into an existing topic: [Reslice performance issues on windows (moved)](https://discourse.slicer.org/t/reslice-performance-issues-on-windows-moved/1914)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 18, 2018, 3:41pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/10 "2018-01-18T15:41:35Z")

</div>

@pieper This is very strange, the `vtkmodules` package is not expected to exist in the current nightly. It also doesn’t exist in the install tree used to create the package:

 ![Screenshot from 2018-01-18 10-39-48](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/5/f52f2d7c150138f18445381648c35acb74f87693.png)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 18, 2018, 3:52pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/11 "2018-01-18T15:52:55Z")

</div>

@pieper I confirm that after installing the nightly package (that was built on the factory), it is different from what you have.

I suspect the `factory.perklab` site maintained by @lassoan is uploading the installer and that would explain what you observed

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 18, 2018, 3:55pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/12 "2018-01-18T15:55:43Z")

</div>

factory.perklab has not been uploading packages for a while (temporarily disabled). I (and probably Steve as well) use the local package folder - `c:\D\S4R\Slicer-build\_CPack_Packages\win-amd64\NSIS\Slicer-4.9.0-2018-01-17-win-amd64`.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 18, 2018, 4:04pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/14 "2018-01-18T16:04:10Z")

</div>

> [@pieper](#):
>
> must happen during the installer step then?

Unlikely, creation of the windows installer consist only in packaging of the install tree.

@lassoan It turns out that `Slicerbot Perklab` is uploading the package. See [http://slicer.kitware.com/midas3/item/338765](http://slicer.kitware.com/midas3/item/338765)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 18, 2018, 4:19pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/16 "2018-01-18T16:19:51Z")

</div>

> Import of VTK modules when built against Qt5 and VTK9

This should be fixed by

> <https://github.com/Slicer/Slicer/issues/871>
>
> \_This issue was created automatically from an original \[Mantis Issue\](https://ma…ntisarchive.slicer.org/view.php?id=871). Further discussion may take place here.\_

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 18, 2018, 4:20pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/17 "2018-01-18T16:20:37Z")

</div>

> [@jcfr](#):
>
> It turns out that Slicerbot Perklab is uploading the package

It is interesting, because the package does not show up in the [dashboard](http://slicer.cdash.org/index.php?project=Slicer4) (no yellow boxes in perklab.factory lines). Are uploading to the dashboard and to MIDAS controlled by different settings?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 18, 2018, 4:27pm UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/18 "2018-01-18T16:27:01Z")

</div>

> [@lassoan](#):
>
> Are uploading to the dashboard and to MIDAS controlled by different settings?

Technically, no installer are uploaded to the dashboard. Only a `.url` file containing a link to the file uploaded on Midas.

I suspect you have the option `WITH_PACKAGES` enabled (see [here](https://github.com/Slicer/Slicer/blob/cea9dcfd94bc1b670126c60a06a6950e5ead1c01/CMake/SlicerDashboardScript.TEMPLATE.cmake#L74)). This would explain why the installer is generated and uploaded.

[https://github.com/Slicer/Slicer/blob/cea9dcfd94bc1b670126c60a06a6950e5ead1c01/CMake/SlicerDashboardDriverScript.cmake#L395-L440](https://github.com/Slicer/Slicer/blob/cea9dcfd94bc1b670126c60a06a6950e5ead1c01/CMake/SlicerDashboardDriverScript.cmake#L395-L440)

If you want to have the package created by only disable the upload of the package, you could set the option `run_ctest_with_upload` to `0`.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [January 22, 2018, 12:21am UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/25 "2018-01-22T00:21:37Z")

</div>

> [@lassoan](#):
>
> It turns out that Slicerbot Perklab is uploading the package

@lassoan Did you have a chance to disable the upload ?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 22, 2018, 5:28am UTC](https://discourse.slicer.org/t/vtk-python-does-not-import-on-todays-windows-nightly/1868/26 "2018-01-22T05:28:14Z")

</div>

> [@jcfr](#):
>
> Did you have a chance to disable the upload ?

I’ve set WITH\_PACKAGES option to FALSE, so from tomorrow it should not upload any package.

Do you know why setting run\_ctest\_with\_upload to FALSE did not disable package upload?

I see on the dashboard that there overload.kitware have not been able to build Slicer successfully in the last couple of days. Could you try to fix that?

Also, the dashboard shows that overload.kitware still tries to build the nightly using VS2013. Is that supposed to work? Haven’t we switched to VS2015 along with Qt5 and VTK9?
