bkntr / napari-brainways

Brainways UI plugin for napari
GNU General Public License v3.0
6 stars 0 forks source link

OSError: exception: access violation reading 0x000000000000001C #19

Closed clarunger closed 1 month ago

clarunger commented 4 months ago

Hi there, I am trying to use brainways for 3D-mapping whole brain images. I'm using it in a conda environment with python 3.9. Unfortunately, when I'm working on the registration of the images, it works for a while, but at some point brainways shuts down and I get this error message:

OSError: exception: access violation reading 0x000000000000001C

Do you have any idea what might be the reason for this and how to solve it? Thanks a lot in advance!

bkntr commented 4 months ago

Hello Clara! Sorry for the late reply. It would be helpful to know which OS are you using, and how much RAM do you have?

clarunger commented 4 months ago

Hey! Thanks a lot for your reply! I am using Windows 10 Pro and have 32.0 GB RAM.

bkntr commented 4 months ago

Do you have more log context for this issue? Meaning are there more lines in the command line before this error?

clarunger commented 4 months ago

Sure, of course. Thank you for taking the time. This what I just got when it shut down brainways.

C:\Users\cunger\AppData\Local\miniconda3\envs\py39env\lib\site-packages\napari\layers\labels\labels.py:886: RuntimeWarning: overflow encountered in scalar multiply!
C:\Users\cunger\AppData\Local\miniconda3\envs\py39env\lib\site-packages\napari\layers\labels\labels.py:886: RuntimeWarning: overflow encountered in scalar multiply!
WARNING: Error drawing visual <Image at 0x17b878aa040>
11:14:44 WARNING Error drawing visual <Image at 0x17b878aa040>
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\app\backends\_qt.py:903, in CanvasBackendDesktop.paintGL(self=<vispy.app.backends._qt.CanvasBackendDesktop object>)
    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 (PyQt5) at 0x17bfd408160>
        self._vispy_canvas.events.draw = <vispy.util.event.EventEmitter object at 0x0000017BFD41D580>
        self = <vispy.app.backends._qt.CanvasBackendDesktop object at 0x0000017BFD41E4C0>
        self._vispy_canvas.events = <vispy.util.event.EmitterGroup object at 0x0000017BFD41D4F0>
    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\miniconda3\envs\py39env\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 0x0000017BFD41D580>
        cb = <bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5) at 0x17bfd408160>>
    454 if event.blocked:
    455     break

File ~\AppData\Local\miniconda3\envs\py39env\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 (PyQt5)>>, 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 0x0000017BFD41D580>
        cb = <bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5) at 0x17bfd408160>>
        event = <DrawEvent blocked=False handled=False native=None region=None source=None sources=[] type=draw>
        (cb, event) = (<bound method SceneCanvas.on_draw of <VispyCanvas (PyQt5) at 0x17bfd408160>>, <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\miniconda3\envs\py39env\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 (PyQt5)>>, 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 (PyQt5) at 0x17bfd408160>>
        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\miniconda3\envs\py39env\lib\site-packages\vispy\scene\canvas.py:218, in SceneCanvas.on_draw(self=<VispyCanvas (PyQt5)>, 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 (PyQt5) at 0x17bfd408160>

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\scene\canvas.py:277, in SceneCanvas._draw_scene(self=<VispyCanvas (PyQt5)>, 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 (PyQt5) at 0x17bfd408160>

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\scene\canvas.py:315, in SceneCanvas.draw_visual(self=<VispyCanvas (PyQt5)>, visual=<SubScene>, event=None)
    313         else:
    314             if hasattr(node, 'draw'):
--> 315                 node.draw()
        node = <Image at 0x17b878aa040>
    316                 prof.mark(str(node))
    317 else:

File ~\AppData\Local\miniconda3\envs\py39env\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 0x17b878aa040>
        self._visual_superclass = <class 'vispy.visuals.image.ImageVisual'>

File ~\AppData\Local\miniconda3\envs\py39env\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 0x17b878aa040>
        self._vshare = <vispy.visuals.visual.VisualShare object at 0x0000017BAD150070>
        self._program = <vispy.visuals.shaders.program.ModularProgram object at 0x0000017BAD169AF0>
        self._vshare.index_buffer = None
    452                        self._vshare.index_buffer)
    453 except Exception:
    454     logger.warning("Error drawing visual %r" % self)

File ~\AppData\Local\miniconda3\envs\py39env\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 0x0000017BAD169AF0>
        args = ('triangles', None)
        kwargs = {}

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\gloo\program.py:543, in Program.draw(self=<vispy.visuals.shaders.program.ModularProgram object>, mode='triangles', indices=None, check_error=True)
    539     raise TypeError("Invalid index: %r (must be IndexBuffer)" %
    540                     indices)
    542 # Process GLIR commands
--> 543 canvas.context.flush_commands()
        canvas = <VispyCanvas (PyQt5) at 0x17bfd408160>

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\gloo\context.py:172, in GLContext.flush_commands(self=<GLContext>, event=None)
    170         fbo = 0
    171     self.shared.parser.parse([('CURRENT', 0, fbo)])
--> 172 self.glir.flush(self.shared.parser)
        self = <GLContext at 0x17bfd41d4c0>

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\gloo\glir.py:584, in GlirQueue.flush(self=<vispy.gloo.glir.GlirQueue object>, parser=<vispy.gloo.glir.GlirParser object>)
    582 def flush(self, parser):
    583     """Flush all current commands to the GLIR interpreter."""
--> 584     self._shared.flush(parser)
        parser = <vispy.gloo.glir.GlirParser object at 0x0000017BFD41D820>
        self._shared = <vispy.gloo.glir._GlirQueueShare object at 0x0000017BFD41D8E0>
        self = <vispy.gloo.glir.GlirQueue object at 0x0000017BFD41D8B0>

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\gloo\glir.py:506, in _GlirQueueShare.flush(self=<vispy.gloo.glir._GlirQueueShare object>, parser=<vispy.gloo.glir.GlirParser object>)
    504     show = self._verbose if isinstance(self._verbose, str) else None
    505     self.show(show)
--> 506 parser.parse(self._filter(self.clear(), parser))
        self = <vispy.gloo.glir._GlirQueueShare object at 0x0000017BFD41D8E0>
        parser = <vispy.gloo.glir.GlirParser object at 0x0000017BFD41D820>

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\gloo\glir.py:824, in GlirParser.parse(self=<vispy.gloo.glir.GlirParser object>, commands=[('FUNC', 'glClearColor', 0.0, 0.0, 0.0, 1.0), ('FUNC', 'glClear', 17664), ('FUNC', 'glDisable', 'cull_face'), ('FUNC', 'glEnable', 'depth_test'), ('FUNC', 'glEnable', 'blend'), ('FUNC', 'glBlendFuncSeparate', 'src_alpha', 'one_minus_src_alpha', 'one', 'one'), ('FUNC', 'glBlendEquationSeparate', 'func_add', 'func_add'), ('DRAW', 2051, 'triangles', (0, 6), 1)])
    821     self._objects.pop(id_)
    823 for command in commands:
--> 824     self._parse(command)
        command = ('DRAW', 2051, 'triangles', (0, 6), 1)
        self = <vispy.gloo.glir.GlirParser object at 0x0000017BFD41D820>

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\gloo\glir.py:786, in GlirParser._parse(self=<vispy.gloo.glir.GlirParser object>, command=('DRAW', 2051, 'triangles', (0, 6), 1))
    783 # Triage over command. Order of commands is set so most
    784 # common ones occur first.
    785 if cmd == 'DRAW':  # Program
--> 786     ob.draw(*args)
        args = ('triangles', (0, 6), 1)
        ob = <GlirProgram 2051 at 0x17babdc0190>
    787 elif cmd == 'TEXTURE':  # Program
    788     ob.set_texture(*args)

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\gloo\glir.py:1357, in GlirProgram.draw(self=<GlirProgram 2051>, mode=GL_TRIANGLES, selection=(0, 6), instances=1)
   1355             gl.glDrawArraysInstanced(mode, first, count, instances)
   1356         else:
-> 1357             gl.glDrawArrays(mode, first, count)
        mode = GL_TRIANGLES
        count = 6
        gl = <module 'vispy.gloo.gl' from 'C:\\Users\\cunger\\AppData\\Local\\miniconda3\\envs\\py39env\\lib\\site-packages\\vispy\\gloo\\gl\\__init__.py'>
        first = 0
   1358 # Wrap up
   1359 gl.check_error('Check after draw')

File ~\AppData\Local\miniconda3\envs\py39env\lib\site-packages\vispy\gloo\gl\_gl2.py:414, in glDrawArrays(mode=GL_TRIANGLES, first=0, count=6)
    412 except AttributeError:
    413     nativefunc = glDrawArrays._native = _get_gl_func("glDrawArrays", None, (ctypes.c_uint, ctypes.c_int, ctypes.c_int,))
--> 414 nativefunc(mode, first, count)
        nativefunc = <_FuncPtr object at 0x0000017B9BF16520>
        mode = GL_TRIANGLES
        first = 0
        count = 6

OSError: exception: access violation reading 0x000000000000001C
bkntr commented 4 months ago

Unfortunately it seems like a known issue in the napari package on windows, which is used behind the scenes as the ui backend for brainways: https://github.com/napari/napari/issues/6472 Maybe you could try updating your GPU drivers? I don't know if it will help but it's worth trying. Another suggestion that may help is to lower the display scaling to 100%, you can access this setting by right-clicking your desktop and choosing "Display Settings".

clarunger commented 4 months ago

Thank you for your recommendations. Unfortunately, the problem persists.

bkntr commented 4 months ago

Sorry I can't help you solve your problem, I hope a fix will be found ASAP in napari

clarunger commented 1 month ago

Downgrading Napari to the 0.4.17 version helped fixing this error. Thank you again! :)

bkntr commented 1 month ago

I am happy to hear that, thank you for updating!