Python VTK Windows OpenGL error

Hello dear VTK developers / users

I am trying to use vtk 9.0.1 from python 3.8.1 on a Windows 10 machine with Intel Graphics UHD 620.

Unfortunately, when I try to open a window, I have a nasty OpenGL error.

Does anyone have a clue (installation of something, or PATH to update…)

python --version
Python 3.8.1

python -m pip install vtk

import vtk
renderer = vtk.vtkRenderer()
window = vtk.vtkRenderWindow()
window.AddRenderer(renderer)
window.Render()
print(vtk.VTK_VERSION)
‘9.0.1’

2021-06-22 17:08:18.097 ( 0.286s) []vtkWin32OpenGLRenderWin:561 ERR| vtkWin32OpenGLRenderWindow (0000022651F86B10): failed to create temporary windows OpenGL context with error: 0
2021-06-22 17:08:18.116 ( 0.304s) []vtkWin32OpenGLRenderWin:569 ERR| vtkWin32OpenGLRenderWindow (0000022651F86B10): GLEW could not be initialized.
2021-06-22 17:08:18.121 ( 0.310s) []vtkOpenGLRenderWindow.c:569 ERR| vtkWin32OpenGLRenderWindow (0000022651F86B10): GLEW could not be initialized: Missing GL version

I think my laptop is able to open a 3D windows, since I can use ParaView 5.6.2 and create a 3D views

Here is the info I have from the excellent ParaView

Version 5.6.2 64-bit
Qt Version 5.12.3
Architecture 64
vtkIdType size 64bits Embedded
Python On
Python Library Version 2.7.15 (default, Sep 5 2018, 14:22:01) [MSC v.1500 64 bit (AMD64)]
Python Numpy Support On
Python Numpy Version 1.15.1
Python Matplotlib Support On
Python Matplotlib Version 1.1.1
Python Testing Off
MPI Enabled Off
Disable Registry Off
OpenGL Vendor Intel
OpenGL Version 3.2.0 - Build 27.20.100.9466
OpenGL Renderer Intel Graphics UHD 620

Do the latest Paraview and the latest 3D Slicer Preview Release work well on your computer?

I have just tested ParaView 5.9.1, and the program paraview.exe works perfectly!

Running a Python script from the “Python shell” window also works great.

However, if I use pvpython.exe form ParaView 5.9.1, I have the same error as if using a classic python.exe with vtk package installed with pip (Same version Python 3.8.6 and VTK 9)

It may be a PATH problem? An initiliatisation that is different between ParaView and (PvPython or Python + VTK)?

C:\ParaView-5.9.1-Windows-Python3.8-msvc2017-64bit\bin\pvpython.exe bug_vtk2.py
( 0.271s) [paraview ]vtkWin32OpenGLRenderWin:622 ERR| vtkWin32OpenGLRenderWindow (00000218615B6830): failed to create temporary windows OpenGL context with error: 0
( 0.275s) [paraview ]vtkWin32OpenGLRenderWin:630 ERR| vtkWin32OpenGLRenderWindow (00000218615B6830): GLEW could not be initialized.
( 0.279s) [paraview ]vtkOpenGLRenderWindow.c:458 ERR| vtkWin32OpenGLRenderWindow (00000218615B6830): GLEW could not be initialized: Missing GL version

I am using the test script provided here: https://kitware.github.io/vtk-examples/site/Python/Tutorial/Tutorial_Step1/

Client Information:
Version: 5.9.1
VTK Version:
Qt Version: 5.15.1
vtkIdType size: 64bits
Embedded Python: On
Python Library Path: C:\ParaView-5.9.1-Windows-Python3.8-msvc2017-64bit\bin\lib
Python Library Version: 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
Python Numpy Support: On
Python Numpy Path: C:\ParaView-5.9.1-Windows-Python3.8-msvc2017-64bit\bin\Lib\site-packages\numpy
Python Numpy Version: 1.19.2
Python Matplotlib Support: On
Python Matplotlib Path: C:\ParaView-5.9.1-Windows-Python3.8-msvc2017-64bit\bin\Lib\site-packages\matplotlib
Python Matplotlib Version: 3.2.1
Python Testing: Off
MPI Enabled: Off
Disable Registry: Off
Test Directory:
Data Directory:
OpenGL Vendor: Intel
OpenGL Version: 3.2.0 - Build 27.20.100.9466
OpenGL Renderer: Intel(R) UHD Graphics 620

Connection Information:
Remote Connection: No