# VTK\_PYTHON\_OPTIONAL\_LINK

**URL:** https://discourse.vtk.org/t/vtk-python-optional-link/484
**Category:** Development
**Created:** [March 14, 2019, 3:41am UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484 "2019-03-14T03:41:30Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [March 14, 2019, 3:41am UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/1 "2019-03-14T03:41:30Z")

</div>

In Windows using Anaconda Python 3.7.1, I had to switch this off in order to get a build. I was getting the following error:  
`LINK : fatal error LNK1104: cannot open file 'python37.lib'`  
It relates to this commit:  
Merge topic ‘reenable-vtk-python-optional-link’

4c9c2e1a7a Remove the block preventing the use of VTK\_PYTHON\_OPTIONAL\_LINK

---

<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: [March 14, 2019, 1:35pm UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/2 "2019-03-14T13:35:01Z")

</div>

Hmm. Our buildbots probably aren’t using 3.13 yet, so were oblivious to it.

Cc: @scottwittenburg The conditional check should probably be `APPLE` rather than `FALSE` while the other platform issues are tracked down.

---

<div class="post-metadata">

### Author: ![scottwittenburg](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scottwittenburg/32/5654_2.png) [@scottwittenburg](https://discourse.vtk.org/u/scottwittenburg)
#### Post date: [March 14, 2019, 2:11pm UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/3 "2019-03-14T14:11:28Z")

</div>

Is that because it seems to be working on OSX? Is that a better way forward for the moment that reverting the previous topic?

---

<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: [March 19, 2019, 2:39pm UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/4 "2019-03-19T14:39:40Z")

</div>

I think whatever we end up doing, a round of ParaView testing needs to be done before it lands in VTK again.

---

<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: [April 7, 2021, 3:30am UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/5 "2021-04-07T03:30:53Z")

</div>

I also had to set  
**VTK\_PYTHON\_OPTIONAL\_LINK=OFF**  
and  
**VTK\_WINDOWS\_PYTHON\_DEBUGGABLE=ON**  
to get it to build with Visual Studio 2017 on Windows 10 from the VTK master branch

---

<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: [April 7, 2021, 12:23pm UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/6 "2021-04-07T12:23:42Z")

</div>

I suspect that the `VTK::Python` code needs an update in the face of `VTK_WINDOWS_PYTHON_DEBUGGABLE` to use the debug library target. I don’t have Windows handy at the moment, but if you want to delve in, changing the `vtk_python_target` variable based on it would be the place to focus on.

---

<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: [April 8, 2021, 1:34am UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/7 "2021-04-08T01:34:14Z")

</div>

It turns out **VTK\_PYTHON\_OPTIONAL\_LINK** is off and hidden by default on Windows, so that wasn’t the issue.

The solution seems to be that **VTK\_WINDOWS\_PYTHON\_DEBUGGABLE** should default to **ON** when building in debug mode, but I think that would require a feature change for CMake _**cmake\_dependent\_option()**_

---

<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: [May 18, 2021, 5:42pm UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/8 "2021-05-18T17:42:02Z")

</div>

Could you please file an issue describing the problem?

---

<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: [May 18, 2021, 10:21pm UTC](https://discourse.vtk.org/t/vtk-python-optional-link/484/9 "2021-05-18T22:21:24Z")

</div>

See [https://gitlab.kitware.com/vtk/vtk/-/issues/17749](https://gitlab.kitware.com/vtk/vtk/-/issues/17749). The problem seems to be here.  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/1/184de7ad9c8632be21b792ead62e86c9b648e090.png)

Setting **VTK\_WINDOWS\_PYTHON\_DEBUGGABLE=ON** prevents UNDEF\_DEBUG but this then requires some other trickery to get the python wrappers to use the release version - described here [https://gitlab.kitware.com/paraview/paraview/-/issues/19428#note\_919269](https://gitlab.kitware.com/paraview/paraview/-/issues/19428#note_919269)
