# error when running tutorial example: working-with-seeg-data

**URL:** <https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120>\
**Category:** Support & Discussions\
**Tags:** visualization\
**Created:** [December 12, 2021, 5:02pm UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120 "2021-12-12T17:02:53Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 12, 2021, 5:02pm UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/1 "2021-12-12T17:02:53Z")

</div>

Dear,  
I am trying to running this tutorial example:  
[https://mne.tools/stable/auto\_tutorials/clinical/20\_seeg.html?highlight=seeg#working-with-seeg-data](https://mne.tools/stable/auto_tutorials/clinical/20_seeg.html?highlight=seeg#working-with-seeg-data)  
however, it showed me error message as below:  
`AttributeError: '_Renderer' object has no attribute '_window_close_connect'`

Also when I am trying to run another tutorial example:  
[https://mne.tools/stable/auto\_tutorials/clinical/10\_ieeg\_localize.html](https://mne.tools/stable/auto_tutorials/clinical/10_ieeg_localize.html)  
it also give me error message as: AttributeError: ‘\_Renderer’ object has no attribute ‘plotter’  
I think it might be package version problem. I am using python3.7.11, mayavi-4.7.4, vtk-9.1.0, numpy 1.21.4.  
Could you please advise?

---

<div class="post-metadata">

**Author:** ![BarryLiu97](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/barryliu97/32/33_2.png) [@BarryLiu97](https://mne.discourse.group/u/BarryLiu97)\
**Post date:** [December 12, 2021, 5:06pm UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/2 "2021-12-12T17:06:55Z")

</div>

I think this might have something to do with the version of mayavi and vtk.  
have a try with

```python
vtk==8.1.2

```

Or much more recommended, use

```python
conda create --name=mne --channel=conda-forge mne

```

which is recommended by MNE officially to install all the packages working well with MNE.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [December 12, 2021, 5:13pm UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/3 "2021-12-12T17:13:18Z")

</div>

Hello @Long, as @BarryLiu97 pointed out, we’d suggest to create an entirely new Python environment for MNE in a situation like this. Please follow the official installation instructions you can find on our website.

Best wishes,  
Richard

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 14, 2021, 9:50am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/4 "2021-12-14T09:50:45Z")

</div>

Thanks for your help on this. As suggested, I install MNE with conda using:

> conda create --name=mne --channel=conda-forge mne

However, when I walk through this example: `https://mne.tools/stable/auto_tutorials/clinical/10_ieeg_localize.html`, when I am trying to locate the ieeg with command:

> gui = mne.gui.locate\_ieeg(raw\_ecog.info, subj\_trans\_ecog, CT\_aligned\_ecog,  
> subject=‘sample\_ecog’,  
> subjects\_dir=op.join(misc\_path, ‘ecog’))

There is no plot showed up, and I can see some message in the console as:

```python
qt.qpa.drawing: Layer-backing can not be explicitly controlled on 10.14 when built against the 10.14 SDK
qt.qpa.window: <QNSWindow: 0x7f945f391c60; contentView=<QNSView: 0x7f945cdf0460; QCocoaWindow(0x6000029563c0, window=QWidgetWindow(0x600003a33c60, name="QWidgetClassWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.
qt.qpa.window: <QNSWindow: 0x7f945f396aa0; contentView=<QNSView: 0x7f945f396690; QCocoaWindow(0x6000029421b0, window=QWidgetWindow(0x600003af1c20, name="QWidgetClassWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.

```

Plot seems stucked through I can see the MNE icon showed up in my mac dock but can’t be clicked to open.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [December 14, 2021, 9:51am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/5 "2021-12-14T09:51:56Z")

</div>

Hello @Long, which version of macOS is that?

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 14, 2021, 9:52am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/6 "2021-12-14T09:52:45Z")

</div>

It’s Monterey 12.0.1.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [December 14, 2021, 9:55am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/7 "2021-12-14T09:55:36Z")

</div>

I’m using 12.1, I can try to run your example later today and check if it works for me. The warnings you see actually shouldn’t be the problem…

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 14, 2021, 9:58am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/8 "2021-12-14T09:58:12Z")

</div>

I will try to upgrade to 12.1 and see. And yes, this message doesn’t looks like the error msg, but still the plot get stucked in my dock and wouldn’t come out. Other plots are working just fine.

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 14, 2021, 10:56am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/9 "2021-12-14T10:56:43Z")

</div>

I just upgraded to 12.1, not working either. The same result.

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 16, 2021, 2:44am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/10 "2021-12-16T02:44:20Z")

</div>

Dear Richard,  
Have you tried on your machine yet? I am still facing the same problem. Appreciate any feedback.

---

<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:** [December 16, 2021, 11:51am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/11 "2021-12-16T11:51:17Z")

</div>

Could you provide the information returned by `mne.sys_info()`?  
I suspect you are running on old versions of Python/PyQt5.

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 17, 2021, 1:03am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/12 "2021-12-17T01:03:31Z")

</div>

Here is the output:

```python
mne.sys_info()
Platform: macOS-12.1-x86_64-i386-64bit
Python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 20:33:18) [Clang 11.1.0]
Executable: /Users/long/opt/anaconda3/envs/mne/bin/python
CPU: i386: 4 cores
Memory: 16.0 GB
mne: 0.24.1
numpy: 1.21.4 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy: 1.7.3
matplotlib: 3.5.0 {backend=MacOSX}
sklearn: 1.0.1
numba: 0.53.1
nibabel: 3.2.1
nilearn: 0.8.1
dipy: 1.4.1
cupy: Not found
pandas: 1.3.4
mayavi: 4.7.2
pyvista: 0.32.1 {OpenGL 4.1 INTEL-18.3.5 via Intel(R) Iris(TM) Plus Graphics 640}
pyvistaqt: 0.5.0
ipyvtklink: Not found
vtk: 9.0.3
PyQt5: 5.12.3
ipympl: Not found
mne_qt_browser: 0.1.7
pooch: v1.5.2

```

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 17, 2021, 5:59am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/13 "2021-12-17T05:59:56Z")

</div>

I just update the PyQt5, but sitll can’t open the plot. Here is the new sys\_info():

```python
mne.sys_info()
Platform: macOS-12.1-x86_64-i386-64bit
Python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 20:33:18) [Clang 11.1.0]
Executable: /Users/long/opt/anaconda3/envs/mne/bin/python
CPU: i386: 4 cores
Memory: 16.0 GB
mne: 0.24.1
numpy: 1.21.4 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy: 1.7.3
matplotlib: 3.5.0 {backend=MacOSX}
sklearn: 1.0.1
numba: 0.53.1
nibabel: 3.2.1
nilearn: 0.8.1
dipy: 1.4.1
cupy: Not found
pandas: 1.3.4
mayavi: 4.7.2
pyvista: 0.32.1 {OpenGL 4.1 INTEL-18.3.5 via Intel(R) Iris(TM) Plus Graphics 640}
pyvistaqt: 0.5.0
ipyvtklink: Not found
vtk: 9.0.3
PyQt5: 5.15.6
ipympl: Not found
mne_qt_browser: 0.1.7
pooch: v1.5.2

```

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 17, 2021, 7:26am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/14 "2021-12-17T07:26:42Z")

</div>

I think I know where goes wrong.  
When I finish plotting the first plot with `viewer = T1.orthoview()` and close it, error msg will show up as:

```python
Traceback (most recent call last):
  File "/Users/long/opt/anaconda3/envs/mne/lib/python3.9/site-packages/matplotlib/cbook/ __init__.py", line 287, in process
    func(*args, **kwargs)
TypeError: _cleanup() takes 1 positional argument but 2 were given

```

Then I run `mne.gui.locate_ieeg`, and it will never show up. However, if I don’t close the first plot, and then go ahead and run the locate\_ieeg, this ieeg plot will show up. But since the first plot is always active, I can’t actually bring the second plot forward. So we still need to find a way to close the first plot and working on the second one.  
Appreciate any help here.

---

<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:** [December 17, 2021, 10:11am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/15 "2021-12-17T10:11:27Z")

</div>

Ok, so the version of Python is fine; and the previous version of PyQt5 was also fine.  
You now have updated outside the limits for MNE: `pyqt5>=5.10,<5.14; platform_system == "Darwin"`.

I have a macOS install on Big Sur, so it’s not 12.xx but I can give it a shot later today and see if I’m able to reproduce.

---

<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:** [December 17, 2021, 10:31am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/16 "2021-12-17T10:31:33Z")

</div>

Never mind, I can reproduce this `TypeError: _cleanup() takes 1 positional argument but 2 were given` on Windows as well with the current dev version of MNE, but it looks like a bug in `nibabel`: [AttributeError raised in OrthoSlicer3D · Issue #920 · nipy/nibabel · GitHub](https://github.com/nipy/nibabel/issues/920)  
Maybe you could try older versions of matplotlib… Or comment this line to skip this problematic plot.

I don’t get the last part however:

> But since the first plot is always active, I can’t actually bring the second plot forward. So we still need to find a way to close the first plot and working on the second one.

Each plot opens in a separate free window, for my case I could close the figure and continue… and then when trying to use `mne.gui.locate_ieeg` I had wrong versions for some dependencies and broke my VTK install 😅

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 18, 2021, 7:00am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/17 "2021-12-18T07:00:05Z")

</div>

I tried go ahead and call mne.gui.locate\_ieeg, however no plot will show up if I do not call the first problematic plot. Very strange. Can you please try on you machine?

For the last part, I mean when I had the problematic plot and locate\_ieeg open at the same time, the first problematic plot will always keep active and stay on top of the other plots even after I click on the locate\_ieeg plot.

I will try old version matplotlib later.

---

<div class="post-metadata">

**Author:** ![Long](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/long/32/374_2.png) [@Long](https://mne.discourse.group/u/Long)\
**Post date:** [December 18, 2021, 7:16am UTC](https://mne.discourse.group/t/error-when-running-tutorial-example-working-with-seeg-data/4120/18 "2021-12-18T07:16:14Z")

</div>

I have tried matplotlib from 3.1 to 3.5. None of them work well for this tutorial example. Actually, the \_cleanup() error doesn’t bother me, what I really want is the mne.git.locate\_ieeg.
