VTK 9 Python vtkContextView not working

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?

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()

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

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.

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.

I have created an issue here.

Ok, thanks!

@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.

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.

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.

1 Like