Search code examples
python-3.xopenglpipvtkpypi

Python3 pip install vtk: OpenGL2 Error


I'm trying to install vtk via pip for Python 3.5.1 under CentOS 7.2. It seems to install and work with the system Python 2.7 instead. I get an OpenGL driver incompatibility error with Python 3.

I must use sudo. My attempts:

  • sudo /path/to/pip3 install vtk
  • sudo /path/to/python3 -m /path/to/pip3 install vtk

When executing a simple cylinder example Python 2 works properly. Python 3 error messaage:

ERROR: In /work/standalone-x64-build/VTK-source/Rendering/OpenGL2/vtkShaderProgram.cxx, line 446
vtkShaderProgram (0x169d500): 0:31(12): error: extension `GL_EXT_gpu_shader4' unsupported in fragment shader

glxinfo output:

server glx vendor string: SGI
server glx version string: 1.4
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
GLX version: 1.4
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.6, 128 bits)
OpenGL version string: 2.1 Mesa 10.6.5
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 10.6.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

I get the same error with Mesa 17.x. Has anyone installed this under Python 3 with success? What version of Mesa and/or llvm is compatible?


Solution

  • The answer posted here works.

    MESA_GL_VERSION_OVERRIDE=3.3 /path/to/executable
    

    I had tried this so many times with a manual install that I gave up on it. I've also seen here that this is a bad idea.

    Edit: I've had to crank up the override version number to 4.5 on other installs.