# VTK 9 Python vtkContextView not working

**URL:** https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761
**Category:** Development
**Created:** [July 13, 2020, 9:37am UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761 "2020-07-13T09:37:13Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![wfenz](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/w/4af34b/32.png) [@wfenz](https://discourse.vtk.org/u/wfenz)
#### Post date: [July 13, 2020, 9:37am UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/1 "2020-07-13T09:37:13Z")

</div>

Hello, I tried a simple example showing a 2D Graph in a Context View, which runs without problems in VTK 8.2, but leads to a segmentation fault when using VTK 9.01 (under Windows 10, Python 3.6.8). Is this a known issue, or has the usage of vtkContextView/vtkChartXY changed somehow?

```auto
import vtk
chart = vtk.vtkChartXY()
f = vtk.vtkPiecewiseFunction()
f.AddPoint(0, 0.0)
f.AddPoint(500, 1)
pf = vtk.vtkPiecewiseFunctionItem()
pf.SetPiecewiseFunction(f)
chart.AddPlot(pf)
view = vtk.vtkContextView()
view.GetScene().AddItem(chart)
view.GetInteractor().Start()

```

---

<div class="post-metadata">

### Author: ![TJ\_Corona](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tj_corona/32/1013_2.png) [@TJ\_Corona](https://discourse.vtk.org/u/TJ_Corona)
#### Post date: [July 14, 2020, 12:06pm UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/2 "2020-07-14T12:06:31Z")

</div>

On which operating system are you running? I just ran your example on OS X and it worked for me.

---

<div class="post-metadata">

### Author: ![wfenz](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/w/4af34b/32.png) [@wfenz](https://discourse.vtk.org/u/wfenz)
#### Post date: [July 14, 2020, 2:00pm UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/3 "2020-07-14T14:00:20Z")

</div>

Like I said, Windows 10. I am using Anaconda and have already tried different environment setups (also with a minimal setup using only Python and vtk modules), and always get a segmentation fault.

---

<div class="post-metadata">

### Author: ![TJ\_Corona](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tj_corona/32/1013_2.png) [@TJ\_Corona](https://discourse.vtk.org/u/TJ_Corona)
#### Post date: [July 14, 2020, 2:08pm UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/4 "2020-07-14T14:08:22Z")

</div>

Ah, sorry. I missed that in your original post.

I can reproduce this issue on Windows 10, Python 3.8. I’ll create an issue and hopefully we can get this fixed.

---

<div class="post-metadata">

### Author: ![TJ\_Corona](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tj_corona/32/1013_2.png) [@TJ\_Corona](https://discourse.vtk.org/u/TJ_Corona)
#### Post date: [July 14, 2020, 2:11pm UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/5 "2020-07-14T14:11:44Z")

</div>

I have created an issue [here](https://gitlab.kitware.com/vtk/vtk/-/issues/17959).

---

<div class="post-metadata">

### Author: ![wfenz](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/w/4af34b/32.png) [@wfenz](https://discourse.vtk.org/u/wfenz)
#### Post date: [July 14, 2020, 2:21pm UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/6 "2020-07-14T14:21:34Z")

</div>

Ok, thanks!

---

<div class="post-metadata">

### Author: ![wfenz](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/w/4af34b/32.png) [@wfenz](https://discourse.vtk.org/u/wfenz)
#### Post date: [August 6, 2020, 2:19pm UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/7 "2020-08-06T14:19:14Z")

</div>

@TJ_Corona: can you produce the stack trace mentioned in the issue? I have no idea how to do that with a Python installation of vtk.

---

<div class="post-metadata">

### Author: ![RMA](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/7bcc69/32.png) [@RMA](https://discourse.vtk.org/u/RMA)
#### Post date: [August 9, 2020, 11:16pm UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/8 "2020-08-09T23:16:24Z")

</div>

Coming in here to say I have the same issue and the above code also results in a seg fault. Tested on OSX 10.14.6 with vtk 9.0.0 & 9.0.1. It runs as expected when using vtk 8.1.2.

I’ve seen in another thread that this may resolved in the master, any word on when it’ll be part of an official release? We’ll have to stick with 8.1.2 until then. Thanks.

---

<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: [August 11, 2020, 12:24pm UTC](https://discourse.vtk.org/t/vtk-9-python-vtkcontextview-not-working/3761/9 "2020-08-11T12:24:05Z")

</div>

The next VTK release is scheduled for an October timeframe (we’re aiming for a 6 month cadence). I thought we had it as part of the release announcement, but it seems not.
