TypeError: Plotter.__init__() got an unexpected keyword argument 'multi_samples'

Hi!

I have been using MNE to perform the pre-processing of my MEG data. As we’re working in a group, we are using a Jupyter Notebook edited on VisualStudio to run the analyses.

We managed to run the co-registration via IPython directly in bash, but I was looking into adding this step into the notebook, and encountered one error.

Here is the complete code I have:

# Imports
import os
import os.path as op
import mne

# Variables
output_path = 'MEGtrain/'
fs_subject = "fs-06"
subjects_dir = op.join(output_path, 'fs/')
os.environ["SUBJECTS_DIR"] = subjects_dir

# Create head-dense.fif file (this works)
mne.bem.make_watershed_bem(subject = fs_subject, overwrite = True)
mne.bem.make_scalp_surfaces(subject = fs_subject, overwrite = True, force = True)

# Display the hemispheres (this does not work)
Brain = mne.viz.get_brain_class()  # Create a Brain object
brain = Brain(subject, 
        hemi = 'both',  # The hemisphere to visualize (`lh`, `rh`, `both`, or `split`)
        subjects_dir = subjects_dir, 
        size = (800, 600)  # The size of the window in pixels
)
brain.add_annotation('aparc.a2009s', borders = False)
brain.add_head(dense = True)

# Co-registration (this does not work)
mne.gui.coregistration(subject = fs_subject, subjects_dir = subjects_dir)

After trying to create the brain object or performing the co-registration, I get this error message:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[6], line 2
      1 Brain = mne.viz.get_brain_class()  # Create a Brain object
----> 2 brain = Brain(subject, 
      3         hemi = 'both',  # The hemisphere to visualize (`lh`, `rh`, `both`, or `split`)
      4         subjects_dir = subjects_dir, 
      5         size = (800, 600)  # The size of the window in pixels
      6 )
      7 brain.add_annotation('aparc.a2009s', borders = False)
      8 brain.add_head(dense = True)

File /megtrain_env/.conda/lib/python3.10/site-packages/mne/viz/_brain/_brain.py:409, in Brain.__init__(***failed resolving arguments***)
    407 logger.debug(f"Hemi offset: {offset}")
    408 _validate_type(theme, (str, None), "theme")
--> 409 self._renderer = _get_renderer(
    410     name=self._title, size=size, bgcolor=self._bg_color, shape=shape, fig=figure
    411 )
    412 self._renderer._window_close_connect(self._clean)
    413 self._renderer._window_set_theme(theme)

File /megtrain_env/.conda/lib/python3.10/site-packages/mne/viz/backends/renderer.py:57, in _get_renderer(*args, **kwargs)
     55 def _get_renderer(*args, **kwargs):
     56     _get_3d_backend()
---> 57     return backend._Renderer(*args, **kwargs)

File /megtrain_env/.conda/lib/python3.10/site-packages/mne/viz/backends/_notebook.py:1561, in _Renderer.__init__(self, *args, **kwargs)
   1555 if not _notebook_vtk_works():
   1556     raise RuntimeError(
   1557         "Using the notebook backend on Linux requires a compatible "
   1558         "VTK setup. Consider using Xfvb or xvfb-run to set up a "
   1559         "working virtual display, or install VTK with OSMesa enabled."
   1560     )
-> 1561 super().__init__(*args, **kwargs)
   1562 self._window_initialize(fullscreen=fullscreen)

File /megtrain_env/.conda/lib/python3.10/site-packages/mne/viz/backends/_pyvista.py:269, in _PyVistaRenderer.__init__(self, fig, size, bgcolor, name, show, shape, notebook, smooth_shading, splash, multi_samples)
    266 # pyvista theme may enable depth peeling by default so
    267 # we disable it initially to better control the value afterwards
    268 with _disabled_depth_peeling():
--> 269     self.plotter = self.figure._build()
    270 self._hide_axes()
    271 self._toggle_antialias()

File /megtrain_env/.conda/lib/python3.10/site-packages/mne/viz/backends/_pyvista.py:161, in PyVistaFigure._build(self)
    159         app = out
    160     self.store["app"] = app
--> 161 plotter = self._plotter_class(**self.store)
    162 plotter.background_color = self.background_color
    163 self._plotter = plotter

TypeError: Plotter.__init__() got an unexpected keyword argument 'multi_samples'

Here’s my specs:

  • MNE version: 1.6.0
  • operating system: CentOS 7.6.1810

Before running the code, I load the modules python/python3.6 and freesurfer/6.0.0.

Do you know where the problem can come from?

Thanks in advance :slight_smile:

Hello! Did you find a solution to this? I’ve encountered the same and wondering what the issue might be.

Hi! No unfortunately :frowning: I’ll leave it opened if anybody gets an idea.