Issue with displaying dipoles

When I tried to display the dipoles using


 fig = mne.viz.plot_dipole_locations(dipoles=dip, mode='arrow', subject=subject,
                                    color=(0.2, 1., 0.5), fig=fig)

I got an error that said :

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Input In [76], in <cell line: 1>()
----> 1 fig = mne.viz.plot_dipole_locations(dipoles=dip, mode='arrow', subject=subject,
      2                                fig=fig)

File <decorator-gen-168>:24, in plot_dipole_locations(dipoles, trans, subject, subjects_dir, mode, coord_frame, idx, show_all, ax, block, show, scale, color, highlight_color, fig, verbose, title)

File ~\Anaconda3\envs\mne\lib\site-packages\mne\viz\_3d.py:2974, in plot_dipole_locations(dipoles, trans, subject, subjects_dir, mode, coord_frame, idx, show_all, ax, block, show, scale, color, highlight_color, fig, verbose, title)
   2972 from .backends.renderer import _get_renderer
   2973 color = (1., 0., 0.) if color is None else color
-> 2974 renderer = _get_renderer(fig=fig, size=(600, 600))
   2975 pos = dipoles.pos
   2976 ori = dipoles.ori

File ~\Anaconda3\envs\mne\lib\site-packages\mne\viz\backends\renderer.py:41, in _get_renderer(*args, **kwargs)
     39 def _get_renderer(*args, **kwargs):
     40     _get_3d_backend()
---> 41     return backend._Renderer(*args, **kwargs)

File ~\Anaconda3\envs\mne\lib\site-packages\mne\viz\backends\_qt.py:648, in _Renderer.__init__(self, *args, **kwargs)
    647 def __init__(self, *args, **kwargs):
--> 648     super().__init__(*args, **kwargs)
    649     self._window_initialize()

File ~\Anaconda3\envs\mne\lib\site-packages\mne\viz\backends\_pyvista.py:196, in _PyVistaRenderer.__init__(self, fig, size, bgcolor, name, show, shape, notebook, smooth_shading)
    193     if not hasattr(self.plotter, "iren"):
    194         self.plotter.iren = None
--> 196 self.update_lighting()

File ~\Anaconda3\envs\mne\lib\site-packages\mne\viz\backends\_pyvista.py:244, in _PyVistaRenderer.update_lighting(self)
    242 for renderer in self._all_renderers:
    243     lights = list(renderer.GetLights())
--> 244     headlight = lights.pop(0)
    245     headlight.SetSwitch(False)
    246     # below and centered, left and above, right and above

IndexError: pop from empty list

How can I fix this?

Can you please post the output of

import mne
mne.sys_info()

Generally it’s a good idea to always include this with a new question, as even if we don’t end up needing that info eventually, it saves one round of back-and-forth in cases where we do need it.

Also, do you think you can provide a minimal working example that reproduces the problem, ideally with a publicly available dataset like the MNE sample data?

Thanks,
Richard

Hi @richard, this is my system specification. I was able to work with the MNE sample data but my own data gave me the above mentioned error

Can you try this with a fresh installation of MNE 1.0.3, preferably with one of our installers?