# Error building VTK with Python wrappers on Windows

**URL:** https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333
**Category:** Support
**Created:** [December 4, 2021, 6:57am UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333 "2021-12-04T06:57:51Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [December 4, 2021, 6:57am UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/1 "2021-12-04T06:57:51Z")

</div>

I’m trying to build VTK with VS2017 and Python wrappers in debug mode and I’m seeing some strange errors. Can someone enlighten me please?

 ![image](https://discourse.vtk.org/uploads/default/original/2X/f/f0c696583b7e6866a09bfb9f57fb1ad9e2d77225.png)

---

<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: [December 4, 2021, 4:17pm UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/2 "2021-12-04T16:17:21Z")

</div>

Looks like an include was missed in dd7554a61106a42cd088acd429ee895dd030a674 (@dgobbi).

---

<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: [December 4, 2021, 4:19pm UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/3 "2021-12-04T16:19:36Z")

</div>

Fixed here: [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/8706](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8706)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [December 5, 2021, 9:38pm UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/4 "2021-12-05T21:38:59Z")

</div>

Thanks. That got me to the next step; a link failure. Is this a _cmake_ error?

 ![image](https://discourse.vtk.org/uploads/default/original/2X/8/859f020a3901d1449c5929866acbddf1c733cb5d.png)

 ![image](https://discourse.vtk.org/uploads/default/original/2X/b/b74b4af90d84eee8789d4c6f730f2269d7c91709.png)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [December 5, 2021, 9:58pm UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/5 "2021-12-05T21:58:08Z")

</div>

I added python36.lib to the **WrappingPythonCore** project’s linker additional dependencies

 ![image](https://discourse.vtk.org/uploads/default/original/2X/9/9b59167832e8e96b0cd6c5d43416b097d4793e29.png)

and that worked but now I see the same problem in the other Python wrapper projects, so I’m guessing there’s a **cmake** issue here for Visual Studio.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/0/0c35d0ad291245980aea776d31c9b4385f4f2a81.png)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [December 9, 2021, 12:07am UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/6 "2021-12-09T00:07:10Z")

</div>

Has anyone actually build the Python wrappers with Visual Studio?

---

<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: [December 10, 2021, 6:49pm UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/7 "2021-12-10T18:49:47Z")

</div>

I did a local build of master today with VS2017, and didn’t run into any issues.

```nohighlight
BUILD_SHARED_LIBS:BOOL=ON
Python3_EXECUTABLE:FILEPATH=F:/Programs/Python39/python.exe
Python3_INCLUDE_DIR:FILEPATH=F:/Programs/Python39/include
Python3_LIBRARY:FILEPATH=F:/Programs/Python39/libs/python39.lib
VTK_PYTHON_VERSION:STRING=3
VTK_WRAP_PYTHON:BOOL=ON

```

I don’t see `BUILD_SHARED_LIBS` in your settings, maybe that’s the cause of the link failure?

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [December 10, 2021, 8:25pm UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/8 "2021-12-10T20:25:31Z")

</div>

**BUILD\_SHARED\_LIBS** is switched on, it was just filtered out of the tree view by the _search_ term.

I did notice this though which got added when I was playing around with trying to build **mpi4py**.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/4f8bad0b5cd64865ab57b668d25fbf0ac12de901.png)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [December 10, 2021, 10:37pm UTC](https://discourse.vtk.org/t/error-building-vtk-with-python-wrappers-on-windows/7333/9 "2021-12-10T22:37:01Z")

</div>

I removed the **NODEFAULTLIB** linker flag and renamed the file _python36.lib_ =\> _python36\_d.lib_ together with

 ![image](https://discourse.vtk.org/uploads/default/original/2X/3/31d255c8d686480f68653f347061d25baaa90f32.png)

Finally I was able to build a debug version of VTK with non-debug Python wrappers.

Alternatively building _RelWithDebInfo_ in VS with **VTK\_WINDOWS\_PYTHON\_DEBUGGABLE=OFF** worked as well.
