vispy / vispy

Main repository for Vispy
http://vispy.org
Other
3.33k stars 618 forks source link

OpenGL not detected correctly? #1688

Closed thomasdeneux closed 3 years ago

thomasdeneux commented 5 years ago

Hello,

I installed vispy on a computer that is a bit old (Lenovo Thinkpad T410 2537) and run into trouble with OpenGL.

OpenGL Extensions Viewer sees the following:

SYSTEM

OPENGL

Trying the examples/basics/gloo/start.py gives AttributeError: 'LooseVersion' object has no attribute 'version' error.

Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Tous droits réservés.

(conda-alphai) C:\Users\Utilisateur\Desktop>python start.py
WARNING: Traceback (most recent call last):
  File "start.py", line 20, in <module>
    app.run()
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\app\_default_app.py", line 62, in run
    return default_app.run()
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\app\application.py", line 142, in run
    return self._backend._vispy_run()
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\app\backends\_qt.py", line 229, in _vispy_run
    return app.exec_()
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\app\backends\_qt.py", line 436, in event
    out = super(QtBaseCanvasBackend, self).event(ev)
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\app\backends\_qt.py", line 708, in paintGL
    self._vispy_canvas.events.draw(region=None)
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\util\event.py", line 455, in __call__
    self._invoke_callback(cb, event)
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\util\event.py", line 475, in _invoke_callback
    self, cb_event=(cb, event))
  << caught exception here: >>
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\util\event.py", line 471, in _invoke_callback
    cb(event)
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\gloo\context.py", line 170, in flush_commands
    self.shared.parser.parse([('CURRENT', 0)])
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\gloo\glir.py", line 477, in parse
    self._parse(command)
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\gloo\glir.py", line 404, in _parse
    self._gl_initialize()
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\site-packages\vispy\gloo\glir.py", line 502, in _gl_initialize
    if this_version < '2.1':
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\distutils\version.py", line 52, in __lt__
    c = self._cmp(other)
  File "C:\Users\Utilisateur\.conda\envs\conda-alphai\lib\distutils\version.py", line 335, in _cmp
    if self.version == other.version:
AttributeError: 'LooseVersion' object has no attribute 'version'
ERROR: Invoking <bound method GLContext.flush_commands of <GLContext at 0x34f2fd0>> for DrawEvent
ERROR: Invoking <bound method GLContext.flush_commands of <GLContext at 0x34f2fd0>> repeat 2
ERROR: Invoking <bound method GLContext.flush_commands of <GLContext at 0x34f2fd0>> repeat 4
ERROR: Invoking <bound method GLContext.flush_commands of <GLContext at 0x34f2fd0>> repeat 8

Checking vispy.sys_info() raises a pyglet.gl.lib.GLException error.

(conda-alphai) C:\Users\Utilisateur\Desktop>python
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bi
t (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import vispy
>>> from pprint import pprint
>>> pprint(vispy.sys_info())
('Platform: Windows-7-6.1.7601-SP1\n'
 'Python:   3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC '
 'v.1915 64 bit (AMD64)]\n'
 'NumPy:    1.16.4\n'
 'Backend:  PyQt5\n'
 'pyqt4:    None\n'
 "pyqt5:    ('PyQt5', '5.9.2', '5.9.6')\n"
 'pyside:   None\n'
 'pyglet:   pyglet 1.3.2\n'
 'glfw:     None\n'
 'sdl2:     None\n'
 'wx:       None\n'
 'egl:      None\n'
 'osmesa:   None\n'
 '_test:    None\n'
 '\n'
 'App info-gathering error:\n'
 'Traceback (most recent call last):\n'
 '  File "C:\\Users\\Utilisateur\\.conda\\envs\\conda-alphai\\lib\\site-packages\\vispy\\util\\config.py", '
 'line 434, in sys_info\n'
 "    out += 'GL version:  %r\\n' % (gl.glGetParameter(gl.GL_VERSION),)\n"
 '  File "C:\\Users\\Utilisateur\\.conda\\envs\\conda-alphai\\lib\\site-packages\\vispy\\gloo\\gl\\_gl2.py", '
 'line 798, in glGetParameter\n'
 '    res = nativefunc(name)\n'
 '  File "C:\\Users\\Utilisateur\\.conda\\envs\\conda-alphai\\lib\\site-packages\\pyglet\\gl\\lib.py", '
 'line 105, in errcheck\n'
 '    raise GLException(msg)\n'
 "pyglet.gl.lib.GLException: b'op\\xe9ration non valide'\n")
>>>

I could not figure out from other related issues where to go from here, so may i request some help here.

djhoese commented 5 years ago

Have you tried updating your video drivers? It really seems like OpenGL just really isn't playing nicely with python and what vispy expects. I'm also confused by the paths in the traceback. Shouldn't there be a python36 directory after lib or does Windows not do that?

thomasdeneux commented 5 years ago

Unfortunately we have already updated the video drivers. We will attempt to uninstall / clean reinstall them though. Regarding the paths, it is because we use a Python environment (conda-alphai) to run our code that python36 does not appear in the path.

djhoese commented 5 years ago

On OSX I have environments with ~/anaconda/envs/vispy_py37_pyqt5/lib/python3.7/site-packages/ so it seemed a little strange. I've never seen that before.

sofroniewn commented 5 years ago

Has there been any progress on this issue? We're running into similar error messages with some of our windows users and our windows CI which uses vispy in this way. See https://github.com/napari/napari/pull/551

I don't have a windows machine readily available, but might be able to access one soonish to start trying to figure this out a little more. It's also not clear to me what specific windows configurations are affected by this issue, but I see in vispy it's been talked about in #1342, #1450, and #1503.

thomasdeneux commented 5 years ago

Hello, no there was no progress, we were not able to run vispy on the above-mentioned computer. I could not find helping information from the mentioned related issues (though at the present time i do not remember all the details).

In fact we have about ten similar reconditioned computers that are a few years old, and were we able to run vispy only on one of them. We would appreciate any progress in figuring out what happens, as we would still like to run vispy on the other computers.

djhoese commented 5 years ago

@sofroniewn What type of python environment are you running on in your CIs and for your users?

As far as I remember when this original distutils error shows up it is because the GL version isn't getting reported to python/vispy/pyopengl/etc from the OpenGL drivers. It is possible that OpenGL isn't being initialized in some way that these drivers need (like showing the active GL canvas before asking what version it is), but it seems odd that other systems/drivers would behave fine. It also seems like intel integrated graphics are usually involved when things go wrong. Perhaps it is something specific (known issue :crossed_fingers: ) in the intel drivers.

(at a conference this week so might not have time to look in to this)

sofroniewn commented 5 years ago

@djhoese we're looking to support python 3.6 and 3.7 for osx, linux, and windows as broadly as is reasonably possible, and at least understand the cases where it isn't possible so we can tell users before they needlessly struggle.

For our CI, we're using cirrus CI to run it, with the configuration of our windows options here - https://github.com/napari/napari/blob/785891502e0870e682f30c124a5c339576db4715/.cirrus.yml#L44

The person who setup our CI is out right now, but maybe @jni can help too.

larsoner commented 3 years ago

Closing since it sounds like these GPUs are too old, but let's reopen if people think there is more to it or we could improve the error message(s)