Mne.viz package creates plot but doesn't open it

When I use mne.viz to create a figure (both in Jupyter Notebook as Atom), a window is opened containing the plot but I can’t open/access it or see the plot.

My code:

renderer = mne.viz.backends.renderer.create_3d_figure(size=(600, 600), bgcolor='w', scene=False)
gray = (0.5, 0.5, 0.5)
renderer.mesh(*rr_mm.T, triangles=tris, color=gray)
view_kwargs = dict(elevation=90, azimuth=0)
mne.viz.set_3d_view(figure=renderer.figure, distance=350, focalpoint=(0., 0., 40.), **view_kwargs)
renderer.show()

Practical info:

  • MNE-Python version: 0.22.0
  • operating system: macOS Big Sur 11.2.1

Hello, that’s something we recently fixed in the development version:

You can either try installing the development version by running

pip install -U https://github.com/mne-tools/mne-python/archive/main.zip

or manually setting the environment variable QT_MAC_WANTS_LAYER to 1.

Thank you!

I set the env variable and the plots are created. However, the problem I have now is that the windows close immediately after they are created.

This issue was discussed recently, please see Why does using a different IDE affect my raw.plot()? - #2 by richard