# error while running "Overview of MEG/EEG analysis with MNE-Python"

**URL:** <https://mne.discourse.group/t/error-while-running-overview-of-meg-eeg-analysis-with-mne-python/7565>\
**Category:** Support & Discussions\
**Created:** [September 25, 2023, 7:36am UTC](https://mne.discourse.group/t/error-while-running-overview-of-meg-eeg-analysis-with-mne-python/7565 "2023-09-25T07:36:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tokoma](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tokoma](https://mne.discourse.group/u/tokoma)\
**Post date:** [September 25, 2023, 7:36am UTC](https://mne.discourse.group/t/error-while-running-overview-of-meg-eeg-analysis-with-mne-python/7565/1 "2023-09-25T07:36:06Z")

</div>

I am trying to run " Overview of MEG/EEG analysis with MNE-Python"  
The URL of this code is as follows:

> **[Overview of MEG/EEG analysis with MNE-Python — MNE 1.11.0 documentation](https://mne.tools/stable/auto_tutorials/intro/10_overview.html#sphx-glr-auto-tutorials-intro-10-overview-py)**

When I ran the following code:  
`raw.compute_psd(fmax=50).plot(picks="data", exclude="bads")`  
the following error occurred .

## /Users/user/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mne/viz/utils.py:161: UserWarning: Matplotlib is currently using module://matplotlib\_inline.backend\_inline, which is a non-GUI backend, so cannot show the figure. (fig or plt).show(\*\*kwargs)

AttributeError Traceback (most recent call last)  
File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/IPython/core/formatters.py:340, in BaseFormatter. **call** (self, obj)  
338 pass  
339 else:  
 → 340 return printer(obj)  
341 # Finally look for special method names  
342 method = get\_real\_method(obj, self.print\_method)

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/IPython/core/pylabtools.py:152, in print\_figure(fig, fmt, bbox\_inches, base64, \*\*kwargs)  
149 from matplotlib.backend\_bases import FigureCanvasBase  
150 FigureCanvasBase(fig)  
 → 152 fig.canvas.print\_figure(bytes\_io, \*\*kw)  
153 data = bytes\_io.getvalue()  
154 if fmt == ‘svg’:

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/backend\_bases.py:2353, in FigureCanvasBase.print\_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox\_inches, pad\_inches, bbox\_extra\_artists, backend, \*\*kwargs)  
2350 bbox\_inches = bbox\_inches.padded(pad\_inches)  
2352 # call adjust\_bbox to save only the given area  
 → 2353 restore\_bbox = \_tight\_bbox.adjust\_bbox(  
2354 self.figure, bbox\_inches, self.figure.canvas.fixed\_dpi)  
2356 \_bbox\_inches\_restore = (bbox\_inches, restore\_bbox)  
2357 else:

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/\_tight\_bbox.py:28, in adjust\_bbox(fig, bbox\_inches, fixed\_dpi)  
26 locator = ax.get\_axes\_locator()  
27 if locator is not None:  
—\> 28 ax.apply\_aspect(locator(ax, None))  
29 locator\_list.append(locator)  
30 current\_pos = ax.get\_position(original=False).frozen()

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/mpl\_toolkits/axes\_grid1/inset\_locator.py:73, in AnchoredLocatorBase. **call** (self, ax, renderer)  
71 def **call** (self, ax, renderer):  
72 self.axes = ax  
—\> 73 bbox = self.get\_window\_extent(renderer)  
74 px, py = self.get\_offset(bbox.width, bbox.height, 0, 0, renderer)  
75 bbox\_canvas = Bbox.from\_bounds(px, py, bbox.width, bbox.height)

File ~/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/matplotlib/offsetbox.py:399, in OffsetBox.get\_window\_extent(self, renderer)  
396 def get\_window\_extent(self, renderer=None):  
397 # docstring inherited  
398 if renderer is None:  
 → 399 renderer = self.figure.\_get\_renderer()  
400 bbox = self.get\_bbox(renderer)  
401 try: # Some subclasses redefine get\_offset to take no args.

AttributeError: ‘NoneType’ object has no attribute ‘\_get\_renderer’

How I can avoid the above error ?

Version info is as follows:

- MNE version: Version: 1.5.1
- operating system: MacOS13.5.2（Ventura）

---

<div class="post-metadata">

**Author:** ![mscheltienne](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mscheltienne/32/827_2.png) [@mscheltienne](https://mne.discourse.group/u/mscheltienne)\
**Post date:** [September 25, 2023, 8:27am UTC](https://mne.discourse.group/t/error-while-running-overview-of-meg-eeg-analysis-with-mne-python/7565/2 "2023-09-25T08:27:35Z")

</div>

Can you try to:

- update matplotlib
- run in the first cell of your notebook `%matplotlib qt`

Mathieu

---

<div class="post-metadata">

**Author:** ![tokoma](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tokoma](https://mne.discourse.group/u/tokoma)\
**Post date:** [September 25, 2023, 9:50am UTC](https://mne.discourse.group/t/error-while-running-overview-of-meg-eeg-analysis-with-mne-python/7565/3 "2023-09-25T09:50:34Z")

</div>

Hi Mathieu,  
I have updated matplotlib and It worked fine without error.  
Thank you !

Makoto
