vtk error in pycharm: GLEW could not be initialized
Asked Answered
A

0

6

How can I run the simple python vtk example from here in pycharm? I've installed vtk version 8.1.2 using pycharm and I'm using python version 3.7.4. Also, I have windows 10.

When I run the example file I get this instead of a 3D cylinder.

ERROR: In C:\VPP\standalone-build\VTK-source\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.cxx, line 685
vtkWin32OpenGLRenderWindow (000001FACEF53880): failed to get wglChoosePixelFormatARB

ERROR: In C:\VPP\standalone-build\VTK-source\Rendering\OpenGL2\vtkWin32OpenGLRenderWindow.cxx, line 769
vtkWin32OpenGLRenderWindow (000001FACEF53880): failed to get valid pixel format.

ERROR: In C:\VPP\standalone-build\VTK-source\Rendering\OpenGL2\vtkOpenGLRenderWindow.cxx, line 785
vtkWin32OpenGLRenderWindow (000001FACEF53880): GLEW could not be initialized.

To fix this error I've tried updating OpenGL by updating my graphics driver. Everything is up to date. The OpenGL Extensions Viewer 6.0 shows me this:

driver info

As requested, these are the packages I have installed along with the version number:

packages

Also as requested, my system path looks like this: (I reformatted it to read easier)

C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\Program Files\PuTTY\;
C:\Program Files\Git\cmd;
C:\WINDOWS\System32\OpenSSH\;
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts;
C:\Users\levib\AppData\Local\Programs\Python\Python37\Scripts\;
C:\Users\levib\AppData\Local\Programs\Python\Python37\;
C:\Users\levib\AppData\Local\Microsoft\WindowsApps;;%CLion%

I've tried following the instructions here but it seems that they are for only if you are using Eclipse with Pydev. (See the top of that page) I'm not sure why that would matter that much but regardless I was unable to find anything similar to the directory structure shown in those instructions around where pycharm installed vtk in my files.

I found the GLEW source here but I don't know what I would even do with that.

This is the closest thing to my question but it has no answer.

Please help! I'm not very familiar in this!

Update:

Still, no luck getting it to run. Someone suggested adding VTK\bin to my path variable and I feel like that could be part of the problem as well. But I can't even find any vtk\bin directory! I know I have vtk though because it imports.

I've tried installing vtk in an anaconda environment (miniconda actually if that makes a difference) but that didn't work either. I got this error instead though.

vtk_error_conda

I'm pretty sure my OpenGL version is sufficient but I'm thinking that vtk can't "find" it or something...?

HELP! I'm getting desperate!

Albino answered 31/10, 2019 at 7:26 Comment(8)
Could you please give the content of the PATH variable, the version of VTK, the list of installed python packages in your environment? Thanks.Fig
Concerning the path var, you mean under View Advance Systems Settings->Environment Variables ?Albino
@Fig Do you mean the user path variable or the system path variable?Albino
I meant the system path that you get during the execution, you could output with: print(os.environ['PATH']). Just to make sure that the VTK bin directory and others are properly configured.Fig
@Fig See edits. By the way, I'm not very familiar in this path var stuff.Albino
@Fig Where would I find the VTK bin directory? I have the package installed at C:\Users\levib\AppData\Local\Programs\Python\Python37\Lib\site-packages\vtk but there is no bin directory in there...Albino
The PATH variable gives locations in which your software will look for the libraries or executables. In some cases, the path to the python package is correct (import works) but this package will again point to another library. At this point the PATH library might be important. Maybe try to add "C:\Program Files (x86)\VTK\bin" to the PATH variable (#42708889). I don't want to mislead you, I have a complicated setup to use VTK and Qt on windows, somehow I needed to add this path. Maybe this won't solve your problem.Fig
@Fig I feel like that could be part of the problem as well. But I can't even find any vtk\bin directory. Did pycharm not download it that way? Do I maybe need to download something else?Albino

© 2022 - 2024 — McMap. All rights reserved.