Error using VTK with PyInstaller

Hello,

I have an application in Python 3.7, with PyQt 5.13.0 and VTK 8.1.2. I use PyInstaller 3.5 to create an executable. The application works with my computer but not with the others on which I tested. I have these error messages :

“failed to get wglChoosePixelFormatARB”
“failed to get valid pixel format”
“GLEW could not be initialized”

Could you help me ?

Hi,
I’m facing the same issue as you did. Did you find any solution yet?
Thanks !

If a program works on one computer but not another, the best way to debug the problem is to check that all the right shared libraries are being loaded.

Use “ldd” on linux, “otool” on macOS, or “Dependency Walker” (depends.exe) on Windows.

For example, on macOS, you can do this:

otool -L lib/python3.5/site-packages/vtkmodules/vtkRenderingOpenGL2Python.so

and the result is this:

    @rpath/libvtkRenderingOpenGL2-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkWrappingPythonCore-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkRenderingCore-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkFiltersCore-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkglew-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 22.0.0)
	@rpath/libvtkCommonExecutionModel-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkCommonDataModel-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkCommonTransforms-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkCommonMisc-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkCommonMath-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libvtkCommonCore-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	@rpath/libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libvtksys-8.90.1.dylib (compatibility version 1.0.0, current version 8.90.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

This tells me that the OpenGL library that vtk-python is using is this one:

/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL

On your system (which I assume is Windows) you could use dependency walker to find out what OpenGL libraries are being used. If you check your computer vs. other computers, you might find that it gives a different answer, especially if the computers have different OpenGL drivers installed.

Also note that most OpenGL capabilities do not work over a remote desktop connection, in case you are trying to use a remote connection for testing.

Just a note, ‘depends.exe’ is quite old now, and doesn’t handle current side-by-side dll dependencies, so results can be confusing.

I found this rewrite does much better on Win10: https://github.com/lucasg/Dependencies

HTH,

Aron

Thanks for the advice. I haven’t had to do this kind of work on Windows for a while.

Thanks for your answer, it’s exactly my case… I assume that I will have to ask for some OpenGL update on the remote connection.
Thanks!