napari: RuntimeError: Using glBindFramebuffer with no OpenGL context.
π Bug
When I drop a png file into the viewer, I get the following error. If I reboot my windows 10 machine, sometimes this error wonβt occur, but in most cases, it will.
The version is 0.4.17rc4, but I tried 0.4.8 and it also errored.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\gloo\gl\_gl2.py:53, in glBindFramebuffer(target=GL_FRAMEBUFFER, framebuffer=1)
52 try:
---> 53 nativefunc = glBindFramebuffer._native
54 except AttributeError:
AttributeError: 'function' object has no attribute '_native'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\gloo\gl\gl2.py:70, in _get_gl_func(name='glBindFramebuffer', restype=None, argtypes=(<class 'ctypes.c_ulong'>, <class 'ctypes.c_ulong'>))
68 try:
69 # Try using normal ctypes stuff
---> 70 func = getattr(_lib, name)
_lib = <WinDLL 'opengl32', handle 7ffc9cc50000 at 0x1e8d26694c0>
name = 'glBindFramebuffer'
71 func.restype = restype
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\ctypes\__init__.py:386, in CDLL.__getattr__(self=<WinDLL 'opengl32', handle 7ffc9cc50000>, name='glBindFramebuffer')
385 raise AttributeError(name)
--> 386 func = self.__getitem__(name)
name = 'glBindFramebuffer'
self = <WinDLL 'opengl32', handle 7ffc9cc50000 at 0x1e8d26694c0>
387 setattr(self, name, func)
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\ctypes\__init__.py:391, in CDLL.__getitem__(self=<WinDLL 'opengl32', handle 7ffc9cc50000>, name_or_ordinal='glBindFramebuffer')
390 def __getitem__(self, name_or_ordinal):
--> 391 func = self._FuncPtr((name_or_ordinal, self))
self._FuncPtr = <class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>
(name_or_ordinal, self) = ('glBindFramebuffer', <WinDLL 'opengl32', handle 7ffc9cc50000 at 0x1e8d26694c0>)
name_or_ordinal = 'glBindFramebuffer'
self = <WinDLL 'opengl32', handle 7ffc9cc50000 at 0x1e8d26694c0>
392 if not isinstance(name_or_ordinal, int):
AttributeError: function 'glBindFramebuffer' not found
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\app\backends\_qt.py:903, in CanvasBackendDesktop.paintGL(self=<vispy.app.backends._qt.CanvasBackendDesktop(0x1e8d70e4d30)>)
901 # (0, 0, self.width(), self.height()))
902 self._vispy_canvas.set_current()
--> 903 self._vispy_canvas.events.draw(region=None)
self._vispy_canvas = <VispyCanvas (PySide2) at 0x1e8d9748640>
self._vispy_canvas.events.draw = <vispy.util.event.EventEmitter object at 0x000001E8D975B2E0>
self = <vispy.app.backends._qt.CanvasBackendDesktop(0x1e8d70e4d30) at 0x000001E8D970B580>
self._vispy_canvas.events = <vispy.util.event.EmitterGroup object at 0x000001E8D975B250>
905 # Clear the alpha channel with QOpenGLWidget (Qt >= 5.4), otherwise the
906 # window is translucent behind non-opaque objects.
907 # Reference: MRtrix3/mrtrix3#266
908 if QT5_NEW_API or PYSIDE6_API or PYQT6_API:
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\util\event.py:453, in EventEmitter.__call__(self=<vispy.util.event.EventEmitter object>, *args=(), **kwargs={'region': None})
450 if self._emitting > 1:
451 raise RuntimeError('EventEmitter loop detected!')
--> 453 self._invoke_callback(cb, event)
event = <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>
self = <vispy.util.event.EventEmitter object at 0x000001E8D975B2E0>
cb = <bound method SceneCanvas.on_draw of <VispyCanvas (PySide2) at 0x1e8d9748640>>
454 if event.blocked:
455 break
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\util\event.py:471, in EventEmitter._invoke_callback(self=<vispy.util.event.EventEmitter object>, cb=<bound method SceneCanvas.on_draw of <VispyCanvas (PySide2)>>, event=<DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>)
469 cb(event)
470 except Exception:
--> 471 _handle_exception(self.ignore_callback_errors,
self = <vispy.util.event.EventEmitter object at 0x000001E8D975B2E0>
cb = <bound method SceneCanvas.on_draw of <VispyCanvas (PySide2) at 0x1e8d9748640>>
event = <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>
(cb, event) = (<bound method SceneCanvas.on_draw of <VispyCanvas (PySide2) at 0x1e8d9748640>>, <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>)
472 self.print_callback_errors,
473 self, cb_event=(cb, event))
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\util\event.py:469, in EventEmitter._invoke_callback(self=<vispy.util.event.EventEmitter object>, cb=<bound method SceneCanvas.on_draw of <VispyCanvas (PySide2)>>, event=<DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>)
467 def _invoke_callback(self, cb, event):
468 try:
--> 469 cb(event)
cb = <bound method SceneCanvas.on_draw of <VispyCanvas (PySide2) at 0x1e8d9748640>>
event = <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>
470 except Exception:
471 _handle_exception(self.ignore_callback_errors,
472 self.print_callback_errors,
473 self, cb_event=(cb, event))
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\scene\canvas.py:218, in SceneCanvas.on_draw(self=<VispyCanvas (PySide2)>, event=<DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>)
215 # Now that a draw event is going to be handled, open up the
216 # scheduling of further updates
217 self._update_pending = False
--> 218 self._draw_scene()
self = <VispyCanvas (PySide2) at 0x1e8d9748640>
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\scene\canvas.py:277, in SceneCanvas._draw_scene(self=<VispyCanvas (PySide2)>, bgcolor=<class 'numpy.ndarray'> (4,) float32)
275 bgcolor = self._bgcolor
276 self.context.clear(color=bgcolor, depth=True)
--> 277 self.draw_visual(self.scene)
self = <VispyCanvas (PySide2) at 0x1e8d9748640>
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\scene\canvas.py:315, in SceneCanvas.draw_visual(self=<VispyCanvas (PySide2)>, visual=<SubScene>, event=None)
313 else:
314 if hasattr(node, 'draw'):
--> 315 node.draw()
node = <Image at 0x1e8e2fafb20>
316 prof.mark(str(node))
317 else:
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\scene\visuals.py:103, in VisualNode.draw(self=<Image>)
101 if self.picking and not self.interactive:
102 return
--> 103 self._visual_superclass.draw(self)
self = <Image at 0x1e8e2fafb20>
self._visual_superclass = <class 'vispy.visuals.image.ImageVisual'>
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\visuals\visual.py:451, in Visual.draw(self=<Image>)
449 self._configure_gl_state()
450 try:
--> 451 self._program.draw(self._vshare.draw_mode,
self._vshare.draw_mode = 'triangles'
self = <Image at 0x1e8e2fafb20>
self._vshare = <vispy.visuals.visual.VisualShare object at 0x000001E8E2FC9400>
self._program = <vispy.visuals.shaders.program.ModularProgram object at 0x000001E8E2FE9190>
self._vshare.index_buffer = None
452 self._vshare.index_buffer)
453 except Exception:
454 logger.warning("Error drawing visual %r" % self)
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\visuals\shaders\program.py:102, in ModularProgram.draw(self=<vispy.visuals.shaders.program.ModularProgram object>, *args=('triangles', None), **kwargs={})
100 self.build_if_needed()
101 self.update_variables()
--> 102 Program.draw(self, *args, **kwargs)
self = <vispy.visuals.shaders.program.ModularProgram object at 0x000001E8E2FE9190>
args = ('triangles', None)
kwargs = {}
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\gloo\program.py:526, in Program.draw(self=<vispy.visuals.shaders.program.ModularProgram object>, mode='triangles', indices=None, check_error=True)
522 raise TypeError("Invalid index: %r (must be IndexBuffer)" %
523 indices)
525 # Process GLIR commands
--> 526 canvas.context.flush_commands()
canvas = <VispyCanvas (PySide2) at 0x1e8d9748640>
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\gloo\context.py:171, in GLContext.flush_commands(self=<GLContext>, event=None)
169 else:
170 fbo = 0
--> 171 self.shared.parser.parse([('CURRENT', 0, fbo)])
self = <GLContext at 0x1e8d975b220>
fbo = 1
[('CURRENT', 0, fbo)] = [('CURRENT', 0, 1)]
('CURRENT', 0, fbo) = ('CURRENT', 0, 1)
172 self.glir.flush(self.shared.parser)
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\gloo\glir.py:822, in GlirParser.parse(self=<vispy.gloo.glir.GlirParser object>, commands=[('CURRENT', 0, 1)])
819 self._objects.pop(id_)
821 for command in commands:
--> 822 self._parse(command)
command = ('CURRENT', 0, 1)
self = <vispy.gloo.glir.GlirParser object at 0x000001E8D975B580>
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\gloo\glir.py:750, in GlirParser._parse(self=<vispy.gloo.glir.GlirParser object>, command=('CURRENT', 0, 1))
748 self._gl_initialize()
749 self.env['fbo'] = args[0]
--> 750 gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, args[0])
args = (1,)
args[0] = 1
gl.GL_FRAMEBUFFER = GL_FRAMEBUFFER
gl = <module 'vispy.gloo.gl' from 'C:\\Users\\Youyi\\AppData\\Local\\napari-0.4.17rc4\\envs\\napari-0.4.17rc4\\lib\\site-packages\\vispy\\gloo\\gl\\__init__.py'>
751 elif cmd == 'FUNC':
752 # GL function call
753 args = [as_enum(a) for a in args]
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\gloo\gl\_gl2.py:55, in glBindFramebuffer(target=GL_FRAMEBUFFER, framebuffer=1)
53 nativefunc = glBindFramebuffer._native
54 except AttributeError:
---> 55 nativefunc = glBindFramebuffer._native = _get_gl_func("glBindFramebuffer", None, (ctypes.c_uint, ctypes.c_uint,))
(ctypes.c_uint, ctypes.c_uint,) = (<class 'ctypes.c_ulong'>, <class 'ctypes.c_ulong'>)
ctypes.c_uint = <class 'ctypes.c_ulong'>
56 nativefunc(target, framebuffer)
File ~\AppData\Local\napari-0.4.17rc4\envs\napari-0.4.17rc4\lib\site-packages\vispy\gloo\gl\gl2.py:85, in _get_gl_func(name='glBindFramebuffer', restype=None, argtypes=(<class 'ctypes.c_ulong'>, <class 'ctypes.c_ulong'>))
81 raise RuntimeError('Function %s not available '
82 '(OpenGL version is %s).'
83 % (name, _get_gl_version(_lib)))
84 if not _have_context():
---> 85 raise RuntimeError('Using %s with no OpenGL context.' % name)
name = 'glBindFramebuffer'
'Using %s with no OpenGL context.' % name = 'Using glBindFramebuffer with no OpenGL context.'
86 address = wglGetProcAddress(name.encode('utf-8'))
87 if address:
RuntimeError: Using glBindFramebuffer with no OpenGL context.
To Reproduce
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 16
Could you show the properties of your GPU cards driver: Something like this:
It would be best if you could check this for both of your GPU. Maybe you need to install drivers for integrated graphics.
(I m sorry, I do not have the option to make a screenshot of the English version of the system.)
The screenshot is of properties of GPU selected from Device manager.
And I wonder if the fact that occasionally napari works when I reboot is due to a randomness in which graphics card is used.
On Thu, Nov 24, 2022 at 11:16 AM Youyi Fong @.***> wrote: