TypeError when I ran the tutorial

In the same code of Overview of MEG/EEG analysis with MNE-Python β€” MNE 1.5.1 documentation, when I ran the following lines:

evoked_diff = mne.combine_evoked([aud_evoked, vis_evoked], weights=[1, -1])
evoked_diff.pick_types(meg="mag").plot_topo(color="r", legend=False)

there was the following warning:

NOTE: pick_types() is a legacy function. New code should use inst.pick(...).
Removing projector <Projection | Average EEG reference, active : True, n_channels : 60>

and the following error occurred:

TypeError: 'clipbox' must be an instance of matplotlib.transforms.BboxBase or None, not a tuple

Should I modify or change the environment of MNE-python ?

Version info is as follows:

  • MNE version: Version: 1.5.1
  • operating system: MacOS13.5.2(VenturaοΌ‰

Hello,

Can you try to update matplotlib?

Mathieu

Hello Mathieu,
Yes, I’ve already updated matplotlib.

pip show matplotlib 

Name: matplotlib
Version: 3.8.0
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: matplotlib-users@python.org
License: PSF
Location: /Users/makoto/opt/anaconda3/envs/myenv/lib/python3.9/site-packages
Requires: contourpy, cycler, fonttools, importlib-resources, kiwisolver, numpy, packaging, pillow, pyparsing, python-dateutil
Required-by: mglearn, mlxtend, mne, pyvista, qulacsvis, seaborn, vtk

Ok, can you share the entire traceback (not just the last line with the TypeError) and the output of:

import mne

mne.sys_info()

Mathieu

Yes,

NOTE: pick_types() is a legacy function. New code should use inst.pick(...).
Removing projector <Projection | Average EEG reference, active : True, n_channels : 60>
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[18], line 2
      1 evoked_diff = mne.combine_evoked([aud_evoked, vis_evoked], weights=[1, -1])
----> 2 evoked_diff.pick_types(meg="mag").plot_topo(color="r", legend=False)

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/evoked.py:565, in Evoked.plot_topo(self, layout, layout_scale, color, border, ylim, scalings, title, proj, vline, fig_background, merge_grads, legend, axes, background_color, noise_cov, exclude, show)
    539 @copy_function_doc_to_method_doc(plot_evoked_topo)
    540 def plot_topo(
    541     self,
   (...)
    558     show=True,
    559 ):
    560     """
    561     Notes
    562     -----
    563     .. versionadded:: 0.10.0
    564     """
--> 565     return plot_evoked_topo(
    566         self,
    567         layout=layout,
    568         layout_scale=layout_scale,
    569         color=color,
    570         border=border,
    571         ylim=ylim,
    572         scalings=scalings,
    573         title=title,
    574         proj=proj,
    575         vline=vline,
    576         fig_background=fig_background,
    577         merge_grads=merge_grads,
    578         legend=legend,
    579         axes=axes,
    580         background_color=background_color,
    581         noise_cov=noise_cov,
    582         exclude=exclude,
    583         show=show,
    584     )

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/evoked.py:1288, in plot_evoked_topo(evoked, layout, layout_scale, color, border, ylim, scalings, title, proj, vline, fig_background, merge_grads, legend, axes, background_color, noise_cov, exclude, show)
   1285         raise ValueError("color must be of type tuple, list, str, or None.")
   1286     color = cycle([color])
-> 1288 return _plot_evoked_topo(
   1289     evoked=evoked,
   1290     layout=layout,
   1291     layout_scale=layout_scale,
   1292     color=color,
   1293     border=border,
   1294     ylim=ylim,
   1295     scalings=scalings,
   1296     title=title,
   1297     proj=proj,
   1298     vline=vline,
   1299     fig_facecolor=fig_facecolor,
   1300     fig_background=fig_background,
   1301     axis_facecolor=axis_facecolor,
   1302     font_color=font_color,
   1303     merge_channels=merge_grads,
   1304     legend=legend,
   1305     axes=axes,
   1306     exclude=exclude,
   1307     show=show,
   1308     noise_cov=noise_cov,
   1309 )

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/topo.py:1079, in _plot_evoked_topo(evoked, layout, layout_scale, color, border, ylim, scalings, title, proj, vline, hline, fig_facecolor, fig_background, axis_facecolor, font_color, merge_channels, legend, axes, exclude, show, noise_cov)
   1077 time_min = min([t[0] for t in times])
   1078 time_max = max([t[-1] for t in times])
-> 1079 fig = _plot_topo(
   1080     info=info,
   1081     times=[time_min, time_max],
   1082     show_func=show_func,
   1083     click_func=click_func,
   1084     layout=layout,
   1085     colorbar=False,
   1086     ylim=ylim_,
   1087     cmap=None,
   1088     layout_scale=layout_scale,
   1089     border=border,
   1090     fig_facecolor=fig_facecolor,
   1091     font_color=font_color,
   1092     axis_facecolor=axis_facecolor,
   1093     title=title,
   1094     x_label="Time (s)",
   1095     y_label=y_label,
   1096     unified=True,
   1097     axes=axes,
   1098 )
   1100 add_background_image(fig, fig_background)
   1102 if legend is not False:

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/topo.py:334, in _plot_topo(info, times, show_func, click_func, layout, vmin, vmax, ylim, colorbar, border, axis_facecolor, fig_facecolor, cmap, layout_scale, title, x_label, y_label, font_color, unified, img, axes)
    331     else:
    332         ylim_ = ylim
--> 334     show_func(ax, ch_idx, tmin=tmin, tmax=tmax, vmin=vmin, vmax=vmax, ylim=ylim_)
    336 if title is not None:
    337     plt.figtext(0.03, 0.95, title, color=font_color, fontsize=15, va="top")

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/topo.py:669, in _plot_timeseries_unified(bn, ch_idx, tmin, tmax, vmin, vmax, ylim, data, color, times, vline, x_label, y_label, colorbar, hline, hvline_color)
    666 # XXX These calls could probably be made faster by using collections
    667 for data_, color_, times_ in zip(data, color, times):
    668     data_lines.append(
--> 669         ax.plot(
    670             bn.x_t + bn.x_s * times_,
    671             bn.y_t + bn.y_s * data_[ch_idx],
    672             linewidth=0.5,
    673             color=color_,
    674             clip_on=True,
    675             clip_box=tuple(pos),
    676         )[0]
    677     )
    678 if vline:
    679     vline = np.array(vline) * bn.x_s + bn.x_t

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/axes/_axes.py:1721, in Axes.plot(self, scalex, scaley, data, *args, **kwargs)
   1478 """
   1479 Plot y versus x as lines and/or markers.
   1480 
   (...)
   1718 (``'green'``) or hex strings (``'#008000'``).
   1719 """
   1720 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1721 lines = [*self._get_lines(self, *args, data=data, **kwargs)]
   1722 for line in lines:
   1723     self.add_line(line)

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/axes/_base.py:303, in _process_plot_var_args.__call__(self, axes, data, *args, **kwargs)
    301     this += args[0],
    302     args = args[1:]
--> 303 yield from self._plot_args(
    304     axes, this, kwargs, ambiguous_fmt_datakey=ambiguous_fmt_datakey)

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/axes/_base.py:539, in _process_plot_var_args._plot_args(self, axes, tup, kwargs, return_kwargs, ambiguous_fmt_datakey)
    537     return list(result)
    538 else:
--> 539     return [l[0] for l in result]

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/axes/_base.py:539, in <listcomp>(.0)
    537     return list(result)
    538 else:
--> 539     return [l[0] for l in result]

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/axes/_base.py:532, in <genexpr>(.0)
    529 else:
    530     labels = [label] * n_datasets
--> 532 result = (make_artist(axes, x[:, j % ncx], y[:, j % ncy], kw,
    533                       {**kwargs, 'label': label})
    534           for j, label in enumerate(labels))
    536 if return_kwargs:
    537     return list(result)

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/axes/_base.py:346, in _process_plot_var_args._makeline(self, axes, x, y, kw, kwargs)
    344 default_dict = self._getdefaults(set(), kw)
    345 self._setdefaults(default_dict, kw)
--> 346 seg = mlines.Line2D(x, y, **kw)
    347 return seg, kw

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/lines.py:407, in Line2D.__init__(self, xdata, ydata, linewidth, linestyle, color, gapcolor, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased, dash_capstyle, solid_capstyle, dash_joinstyle, solid_joinstyle, pickradius, drawstyle, markevery, **kwargs)
    403 self.set_markeredgewidth(markeredgewidth)
    405 # update kwargs before updating data to give the caller a
    406 # chance to init axes (and hence unit support)
--> 407 self._internal_update(kwargs)
    408 self.pickradius = pickradius
    409 self.ind_offset = 0

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/artist.py:1219, in Artist._internal_update(self, kwargs)
   1212 def _internal_update(self, kwargs):
   1213     """
   1214     Update artist properties without prenormalizing them, but generating
   1215     errors as if calling `set`.
   1216 
   1217     The lack of prenormalization is to maintain backcompatibility.
   1218     """
-> 1219     return self._update_props(
   1220         kwargs, "{cls.__name__}.set() got an unexpected keyword argument "
   1221         "{prop_name!r}")

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/artist.py:1195, in Artist._update_props(self, props, errfmt)
   1192             if not callable(func):
   1193                 raise AttributeError(
   1194                     errfmt.format(cls=type(self), prop_name=k))
-> 1195             ret.append(func(v))
   1196 if ret:
   1197     self.pchanged()

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/artist.py:766, in Artist.set_clip_box(self, clipbox)
    754 def set_clip_box(self, clipbox):
    755     """
    756     Set the artist's clip `.Bbox`.
    757 
   (...)
    764 
    765     """
--> 766     _api.check_isinstance((BboxBase, None), clipbox=clipbox)
    767     if clipbox != self.clipbox:
    768         self.clipbox = clipbox

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/_api/__init__.py:91, in check_isinstance(types, **kwargs)
     89     names.remove("None")
     90     names.append("None")
---> 91 raise TypeError(
     92     "{!r} must be an instance of {}, not a {}".format(
     93         k,
     94         ", ".join(names[:-1]) + " or " + names[-1]
     95         if len(names) > 1 else names[0],
     96         type_name(type(v))))

TypeError: 'clipbox' must be an instance of matplotlib.transforms.BboxBase or None, not a tuple

Here, mne.info():

Platform             macOS-13.5.2-arm64-arm-64bit
Python               3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:38:11)  [Clang 14.0.6 ]
Executable           /Users/makoto/opt/anaconda3/envs/myenv/bin/python
CPU                  arm (8 cores)
Memory               16.0 GB

Core
β”œβ˜‘ mne               1.5.1
β”œβ˜‘ numpy             1.23.5 (OpenBLAS 0.3.20 with 8 threads)
β”œβ˜‘ scipy             1.10.0
β”œβ˜‘ matplotlib        3.8.0 (backend=module://matplotlib_inline.backend_inline)
β”œβ˜‘ pooch             1.7.0
β””β˜‘ jinja2            3.1.2

Numerical (optional)
β”œβ˜‘ sklearn           1.3.0
β”œβ˜‘ numba             0.57.1
β”œβ˜‘ nibabel           5.1.0
β”œβ˜‘ dipy              1.7.0
β”œβ˜‘ pandas            2.0.3
β””β˜ unavailable       nilearn, openmeeg, cupy

Visualization (optional)
β”œβ˜‘ pyvista           0.42.1 (OpenGL 4.1 Metal - 83.1 via Apple M1)
β”œβ˜‘ pyvistaqt         0.11.0
β”œβ˜‘ vtk               9.2.6
β”œβ˜‘ ipywidgets        8.1.1
β””β˜ unavailable       qtpy, ipympl, pyqtgraph, mne-qt-browser, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
β””β˜ unavailable       mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline

That was fixed in BUG: Fix bug with clip box setting by larsoner Β· Pull Request #11999 Β· mne-tools/mne-python Β· GitHub which is not yet released in the stable version. It will be fixed in v1.5.2.
If you need it now, you can install the maintenance branch that will be used to release v1.5.2:

pip install git+https://github.com/mne-tools/mne-python.git@maint/1.5

Mathieu

1 Like

Hello
The situarion is the same with installing the version:

% pip install git+https://github.com/mne-tools/mne-python.git@maint/1.5
Collecting git+https://github.com/mne-tools/mne-python.git@maint/1.5
  Cloning https://github.com/mne-tools/mne-python.git (to revision maint/1.5) to /private/var/folders/q9/hjtxkzvd5yd3ql4lqbq_14cw0000gn/T/pip-req-build-2ro169ru
  Running command git clone --filter=blob:none --quiet https://github.com/mne-tools/mne-python.git /private/var/folders/q9/hjtxkzvd5yd3ql4lqbq_14cw0000gn/T/pip-req-build-2ro169ru
  Running command git checkout -b maint/1.5 --track origin/maint/1.5
  Switched to a new branch 'maint/1.5'
  branch 'maint/1.5' set up to track 'origin/maint/1.5'.
  Resolved https://github.com/mne-tools/mne-python.git to commit 77328c09b8f709bee2c702d66cc8935fcf8c83d5
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.15.4 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.5.1) (1.23.5)
Requirement already satisfied: scipy>=1.6.3 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.5.1) (1.10.0)
Requirement already satisfied: matplotlib>=3.4.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.5.1) (3.8.0)
Requirement already satisfied: tqdm in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.5.1) (4.65.0)
Requirement already satisfied: pooch>=1.5 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.5.1) (1.7.0)
Requirement already satisfied: decorator in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.5.1) (5.1.1)
Requirement already satisfied: packaging in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.5.1) (23.1)
Requirement already satisfied: jinja2 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.5.1) (3.1.2)
Requirement already satisfied: contourpy>=1.0.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.0->mne==1.5.1) (1.1.0)
Requirement already satisfied: cycler>=0.10 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.0->mne==1.5.1) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.0->mne==1.5.1) (4.40.0)
Requirement already satisfied: kiwisolver>=1.0.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.0->mne==1.5.1) (1.4.4)
Requirement already satisfied: pillow>=6.2.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.0->mne==1.5.1) (9.5.0)
Requirement already satisfied: pyparsing>=2.3.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.0->mne==1.5.1) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.0->mne==1.5.1) (2.8.2)
Requirement already satisfied: importlib-resources>=3.2.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.0->mne==1.5.1) (6.0.0)
Requirement already satisfied: platformdirs>=2.5.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from pooch>=1.5->mne==1.5.1) (3.8.1)
Requirement already satisfied: requests>=2.19.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from pooch>=1.5->mne==1.5.1) (2.31.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from jinja2->mne==1.5.1) (2.1.3)
Requirement already satisfied: zipp>=3.1.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from importlib-resources>=3.2.0->matplotlib>=3.4.0->mne==1.5.1) (3.16.0)
Requirement already satisfied: six>=1.5 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib>=3.4.0->mne==1.5.1) (1.16.0)
Requirement already satisfied: charset-normalizer<4,>=2 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from requests>=2.19.0->pooch>=1.5->mne==1.5.1) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from requests>=2.19.0->pooch>=1.5->mne==1.5.1) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from requests>=2.19.0->pooch>=1.5->mne==1.5.1) (1.26.16)
Requirement already satisfied: certifi>=2017.4.17 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from requests>=2.19.0->pooch>=1.5->mne==1.5.1) (2023.7.22)
Building wheels for collected packages: mne
  Building wheel for mne (pyproject.toml) ... done
  Created wheel for mne: filename=mne-1.5.1-py3-none-any.whl size=7672477 sha256=6ec600a04e83a0684af871f08d0b92afd601c7ee7b4f159badb707c7ecdde61b
  Stored in directory: /private/var/folders/q9/hjtxkzvd5yd3ql4lqbq_14cw0000gn/T/pip-ephem-wheel-cache-voog9266/wheels/76/53/0d/789084ed88615ca700b564cc0eb3208a73c9d76e94e0164f59
Successfully built mne
Installing collected packages: mne
  Attempting uninstall: mne
    Found existing installation: mne 1.6.0.dev91+g079c86824
    Uninstalling mne-1.6.0.dev91+g079c86824:
      Successfully uninstalled mne-1.6.0.dev91+g079c86824
Successfully installed mne-1.5.1
(myenv) makoto@MakotonoMacBook-Air ~ % python                                                               
Python 3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:38:11) 
[Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mne
>>> mne.sys_info()
Platform             macOS-13.5.2-arm64-arm-64bit
Python               3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:38:11)  [Clang 14.0.6 ]
Executable           /Users/makoto/opt/anaconda3/envs/myenv/bin/python
CPU                  arm (8 cores)
Memory               16.0 GB

Core
β”œβ˜‘ mne               1.5.1
β”œβ˜‘ numpy             1.23.5 (OpenBLAS 0.3.20 with 8 threads)
β”œβ˜‘ scipy             1.10.0
β”œβ˜‘ matplotlib        3.8.0 (backend=MacOSX)
β”œβ˜‘ pooch             1.7.0
β””β˜‘ jinja2            3.1.2

Numerical (optional)
β”œβ˜‘ sklearn           1.3.0
β”œβ˜‘ numba             0.57.1
β”œβ˜‘ nibabel           5.1.0
β”œβ˜‘ dipy              1.7.0
β”œβ˜‘ pandas            2.0.3
β””β˜ unavailable       nilearn, openmeeg, cupy

Visualization (optional)
β”œβ˜‘ pyvista           0.42.1 (OpenGL 4.1 Metal - 83.1 via Apple M1)
β”œβ˜‘ pyvistaqt         0.11.0
β”œβ˜‘ vtk               9.2.6
β”œβ˜‘ ipympl            0.9.3
β”œβ˜‘ ipywidgets        8.1.1
β””β˜ unavailable       qtpy, pyqtgraph, mne-qt-browser, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
β””β˜ unavailable       mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline
>>>

It worked with the latest version:

% pip install git+https://github.com/mne-tools/mne-python.git@main

Collecting git+https://github.com/mne-tools/mne-python.git@main

Cloning https://github.com/mne-tools/mne-python.git (to revision main) to /private/var/folders/q9/hjtxkzvd5yd3ql4lqbq_14cw0000gn/T/pip-req-build-_q8yb2vm

Running command git clone --filter=blob:none --quiet https://github.com/mne-tools/mne-python.git /private/var/folders/q9/hjtxkzvd5yd3ql4lqbq_14cw0000gn/T/pip-req-build-_q8yb2vm

Resolved https://github.com/mne-tools/mne-python.git to commit 079c868240a898204bf82b2f1bf0e04cdee75da1

Installing build dependencies ... done

Getting requirements to build wheel ... done

Installing backend dependencies ... done

Preparing metadata (pyproject.toml) ... done

Requirement already satisfied: numpy>=1.21.2 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (1.23.5)

Requirement already satisfied: scipy>=1.7.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (1.10.0)

Requirement already satisfied: matplotlib>=3.4.3 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (3.8.0)

Requirement already satisfied: tqdm in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (4.65.0)

Requirement already satisfied: pooch>=1.5 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (1.7.0)

Requirement already satisfied: decorator in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (5.1.1)

Requirement already satisfied: packaging in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (23.1)

Requirement already satisfied: jinja2 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (3.1.2)

Requirement already satisfied: lazy-loader>=0.3 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (0.3)

Requirement already satisfied: defusedxml in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from mne==1.6.0.dev91+g079c86824) (0.7.1)

Requirement already satisfied: contourpy>=1.0.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (1.1.0)

Requirement already satisfied: cycler>=0.10 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (0.11.0)

Requirement already satisfied: fonttools>=4.22.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (4.40.0)

Requirement already satisfied: kiwisolver>=1.0.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (1.4.4)

Requirement already satisfied: pillow>=6.2.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (9.5.0)

Requirement already satisfied: pyparsing>=2.3.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (3.0.9)

Requirement already satisfied: python-dateutil>=2.7 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (2.8.2)

Requirement already satisfied: importlib-resources>=3.2.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (6.0.0)

Requirement already satisfied: platformdirs>=2.5.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from pooch>=1.5->mne==1.6.0.dev91+g079c86824) (3.8.1)

Requirement already satisfied: requests>=2.19.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from pooch>=1.5->mne==1.6.0.dev91+g079c86824) (2.31.0)

Requirement already satisfied: MarkupSafe>=2.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from jinja2->mne==1.6.0.dev91+g079c86824) (2.1.3)

Requirement already satisfied: zipp>=3.1.0 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from importlib-resources>=3.2.0->matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (3.16.0)

Requirement already satisfied: six>=1.5 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib>=3.4.3->mne==1.6.0.dev91+g079c86824) (1.16.0)

Requirement already satisfied: charset-normalizer<4,>=2 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from requests>=2.19.0->pooch>=1.5->mne==1.6.0.dev91+g079c86824) (3.2.0)

Requirement already satisfied: idna<4,>=2.5 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from requests>=2.19.0->pooch>=1.5->mne==1.6.0.dev91+g079c86824) (3.4)

Requirement already satisfied: urllib3<3,>=1.21.1 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from requests>=2.19.0->pooch>=1.5->mne==1.6.0.dev91+g079c86824) (1.26.16)

Requirement already satisfied: certifi>=2017.4.17 in ./opt/anaconda3/envs/myenv/lib/python3.9/site-packages (from requests>=2.19.0->pooch>=1.5->mne==1.6.0.dev91+g079c86824) (2023.7.22)

Building wheels for collected packages: mne

Building wheel for mne (pyproject.toml) ... done

Created wheel for mne: filename=mne-1.6.0.dev91+g079c86824-py3-none-any.whl size=7700694 sha256=8d856b0989a445533ecce2fd3bf138c43c0014f2147bf8bcfbd868790fced0f0

Stored in directory: /private/var/folders/q9/hjtxkzvd5yd3ql4lqbq_14cw0000gn/T/pip-ephem-wheel-cache-geqbvloe/wheels/1e/ea/29/e55eee9c5b26218259e60fd0ff2afdaf13b34d12c1c128f23c

Successfully built mne

Installing collected packages: mne

Attempting uninstall: mne

Found existing installation: mne 1.5.1

Uninstalling mne-1.5.1:

Successfully uninstalled mne-1.5.1

Successfully installed mne-1.6.0.dev91+g079c86824

Using ether 1.5.1 or the latest fails at the following code:

# path to subjects' MRI files
subjects_dir = sample_data_folder / "subjects"
# plot the STC
stc.plot(
    initial_time=0.1, hemi="split", views=["lat", "med"], subjects_dir=subjects_dir
)

The error is as follows:

/Users/makoto/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/pyvista/jupyter/notebook.py:33: UserWarning: Failed to use notebook backend: 

No module named 'trame'

Falling back to a static output.
  warnings.warn(
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[20], line 4
      2 subjects_dir = sample_data_folder / "subjects"
      3 # plot the STC
----> 4 stc.plot(
      5     initial_time=0.1, hemi="split", views=["lat", "med"], subjects_dir=subjects_dir
      6 )

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/source_estimate.py:740, in _BaseSourceEstimate.plot(self, subject, surface, hemi, colormap, time_label, smoothing_steps, transparent, alpha, time_viewer, subjects_dir, figure, views, colorbar, clim, cortex, size, background, foreground, initial_time, time_unit, backend, spacing, title, show_traces, src, volume_options, view_layout, add_data_kwargs, brain_kwargs, verbose)
    706 @copy_function_doc_to_method_doc(plot_source_estimates)
    707 def plot(
    708     self,
   (...)
    738     verbose=None,
    739 ):
--> 740     brain = plot_source_estimates(
    741         self,
    742         subject,
    743         surface=surface,
    744         hemi=hemi,
    745         colormap=colormap,
    746         time_label=time_label,
    747         smoothing_steps=smoothing_steps,
    748         transparent=transparent,
    749         alpha=alpha,
    750         time_viewer=time_viewer,
    751         subjects_dir=subjects_dir,
    752         figure=figure,
    753         views=views,
    754         colorbar=colorbar,
    755         clim=clim,
    756         cortex=cortex,
    757         size=size,
    758         background=background,
    759         foreground=foreground,
    760         initial_time=initial_time,
    761         time_unit=time_unit,
    762         backend=backend,
    763         spacing=spacing,
    764         title=title,
    765         show_traces=show_traces,
    766         src=src,
    767         volume_options=volume_options,
    768         view_layout=view_layout,
    769         add_data_kwargs=add_data_kwargs,
    770         brain_kwargs=brain_kwargs,
    771         verbose=verbose,
    772     )
    773     return brain

File <decorator-gen-130>:12, in plot_source_estimates(stc, subject, surface, hemi, colormap, time_label, smoothing_steps, transparent, alpha, time_viewer, subjects_dir, figure, views, colorbar, clim, cortex, size, background, foreground, initial_time, time_unit, backend, spacing, title, show_traces, src, volume_options, view_layout, add_data_kwargs, brain_kwargs, verbose)

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/_3d.py:2467, in plot_source_estimates(stc, subject, surface, hemi, colormap, time_label, smoothing_steps, transparent, alpha, time_viewer, subjects_dir, figure, views, colorbar, clim, cortex, size, background, foreground, initial_time, time_unit, backend, spacing, title, show_traces, src, volume_options, view_layout, add_data_kwargs, brain_kwargs, verbose)
   2465 else:
   2466     with use_3d_backend(backend):
-> 2467         return _plot_stc(
   2468             stc,
   2469             overlay_alpha=alpha,
   2470             brain_alpha=alpha,
   2471             vector_alpha=alpha,
   2472             cortex=cortex,
   2473             foreground=foreground,
   2474             size=size,
   2475             scale_factor=None,
   2476             show_traces=show_traces,
   2477             src=src,
   2478             volume_options=volume_options,
   2479             view_layout=view_layout,
   2480             add_data_kwargs=add_data_kwargs,
   2481             brain_kwargs=brain_kwargs,
   2482             **kwargs,
   2483         )

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/_3d.py:2637, in _plot_stc(stc, subject, surface, hemi, colormap, time_label, smoothing_steps, subjects_dir, views, clim, figure, initial_time, time_unit, background, time_viewer, colorbar, transparent, brain_alpha, overlay_alpha, vector_alpha, cortex, foreground, size, scale_factor, show_traces, src, volume_options, view_layout, add_data_kwargs, brain_kwargs)
   2634 del kwargs
   2636 if time_viewer:
-> 2637     brain.setup_time_viewer(time_viewer=time_viewer, show_traces=show_traces)
   2638 else:
   2639     brain.show()

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/_brain/_brain.py:604, in Brain.setup_time_viewer(***failed resolving arguments***)
    602 # show everything at the end
    603 self.toggle_interface()
--> 604 self._renderer.show()
    606 # sizes could change, update views
    607 for hemi in ("lh", "rh"):

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/backends/_notebook.py:1597, in _Renderer.show(self)
   1585 viewer = self.plotter.show(jupyter_backend=_JUPYTER_BACKEND, return_viewer=True)
   1586 if _JUPYTER_BACKEND == "trame":
   1587     # Remove scrollbars, see https://github.com/pyvista/pyvista/pull/4847
   1588     # which adds this to the iframe PyVista creates. Once that's merged, this
   (...)
   1591     # live with the ugly 90's-style borders. We can probably remove once we
   1592     # require PyVista 0.43 (assuming the above PR is merged).
   1593     viewer.value = re.sub(
   1594         r" style=[\"'](.+)[\"']></iframe>",
   1595         # value taken from matplotlib's widget
   1596         r" style='\1; border: 1px solid rgb(221,221,221);' scrolling='no'></iframe>",  # noqa: E501
-> 1597         viewer.value,
   1598     )
   1599 rendering_row = list()
   1600 if self._docks is not None and "left" in self._docks:

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/PIL/Image.py:528, in Image.__getattr__(self, name)
    526     deprecate("Image categories", 10, "is_animated", plural=True)
    527     return self._category
--> 528 raise AttributeError(name)

AttributeError: value

Try installing the trane python module. This is now a dependancy of MNE-Python.

1 Like