Hi everyone,
It might be a messy explanation since I do not understand what exactly is going on, so please bear with me:
Plotting somehow works inconsistently for me, such that sometimes I can plot interactive pop-up windows and sometimes in the plot pane. This worked all right (playing around with matplotlib backends, even though I did not fully grasp what was happening under the hood) until recently.
For some reason, I am not able to plot as before, (pop-up windows open empty and show a loading sign for hours), and often the plot wonβt even appear on the plotting pane, e.g.
heartbeat_evoked_v1.plot()
Traceback (most recent call last):
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/IPython/core/formatters.py:340 in __call__
return printer(obj)
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/IPython/core/pylabtools.py:152 in print_figure
fig.canvas.print_figure(bytes_io, **kw)
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backends/backend_qtagg.py:75 in print_figure
super().print_figure(*args, **kwargs)
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backend_bases.py:2353 in print_figure
restore_bbox = _tight_bbox.adjust_bbox(
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/_tight_bbox.py:28 in adjust_bbox
ax.apply_aspect(locator(ax, None))
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/mpl_toolkits/axes_grid1/inset_locator.py:73 in __call__
bbox = self.get_window_extent(renderer)
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/offsetbox.py:399 in get_window_extent
renderer = self.figure._get_renderer()
AttributeError: 'NoneType' object has no attribute '_get_renderer'
Out[20]: <Figure size 920x432 with 2 Axes>
or
heartbeat_evoked_v1.plot
Out[21]: <bound method Evoked.plot of <Evoked | '0.00 Γ Comment/actiCAP Data On + 0.00 Γ New Segment/ + 1.00 Γ R-peak' (average, N=390), -0.3 β 0.8 s, baseline -0.3 β 0 s, 31 ch, ~110 kB>>
but no plot appearing
I figured I needed to update conda and MNE but hit a dead end because I could not update anything due to this error I was not able to circumvent even though I tried many recommended solutions:
(mne-1.5.1_0) denizyilmaz@Denizs-MacBook-Pro ~ % conda update anaconda
conda install spyder=5.5.1
Error while loading conda entry point: conda-libmamba-solver (dlopen(/Users/denizyilmaz/anaconda3/lib/python3.11/site-packages/libmambapy/bindings.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libarchive.19.dylib
Referenced from: <9391E88D-A5AA-33C9-8306-75BC6FFBC365> /Users/denizyilmaz/anaconda3/lib/libmamba.2.0.0.dylib
Reason: tried: '/Users/denizyilmaz/anaconda3/lib/libarchive.19.dylib' (no such file), '/Users/denizyilmaz/anaconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.19.dylib' (no such file), '/Users/denizyilmaz/anaconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.19.dylib' (no such file), '/Users/denizyilmaz/anaconda3/bin/../lib/libarchive.19.dylib' (no such file), '/Users/denizyilmaz/anaconda3/bin/../lib/libarchive.19.dylib' (no such file), '/usr/local/lib/libarchive.19.dylib' (no such file), '/usr/lib/libarchive.19.dylib' (no such file, not in dyld cache))
When I run the following command on my working session, where unexpectedly pop-up interactive plotting did work:
import mne
mne.sys_info()
Platform macOS-14.0-arm64-i386-64bit
Python 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:33:12) [Clang 15.0.7 ]
Executable /Applications/MNE-Python/1.5.1_0/.mne-python/bin/python
CPU i386 (10 cores)
Memory 16.0 GB
Core
ββ mne 1.5.1
ββ numpy 1.24.4 (OpenBLAS 0.3.24 with 10 threads)
ββ scipy 1.11.2
ββ matplotlib 3.7.2 (backend=TkAgg)
ββ pooch 1.7.0
ββ jinja2 3.1.2
Numerical (optional)
ββ sklearn 1.3.0
ββ numba 0.57.1
ββ nibabel 5.0.1
ββ nilearn 0.10.1
ββ dipy 1.7.0
ββ openmeeg 2.5.6
ββ pandas 2.1.0
ββ unavailable cupy
Visualization (optional)
ββ pyvista 0.41.1 (OpenGL 4.1 Metal - 86 via Apple M1 Pro)
ββ pyvistaqt 0.0.0
ββ vtk 9.2.6
ββ qtpy 2.4.0 (PyQt5=5.15.8)
Exception in Tkinter callback
Traceback (most recent call last):
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/tkinter/__init__.py", line 1948, in __call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 552, in destroy
Gcf.destroy(self)
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/_pylab_helpers.py", line 66, in destroy
manager.destroy()
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 587, in destroy
delayed_destroy()
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 577, in delayed_destroy
self.window.destroy()
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/tkinter/__init__.py", line 2368, in destroy
self.tk.call('destroy', self._w)
_tkinter.TclError: can't invoke "destroy" command: application has been destroyed
Exception in Tkinter callback
Traceback (most recent call last):
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/tkinter/__init__.py", line 1948, in __call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 552, in destroy
Gcf.destroy(self)
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/_pylab_helpers.py", line 66, in destroy
manager.destroy()
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 587, in destroy
delayed_destroy()
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backends/_backend_tk.py", line 577, in delayed_destroy
self.window.destroy()
File "/Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/tkinter/__init__.py", line 2368, in destroy
self.tk.call('destroy', self._w)
_tkinter.TclError: can't invoke "destroy" command: application has been destroyed
2024-05-03 10:36:55,576 - OpenGL.acceleratesupport - INFO - No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
ββ pyqtgraph 0.13.3
ββ mne-qt-browser 0.5.2
ββ ipywidgets 8.1.0
ββ trame_client 2.11.2
ββ trame_server 2.11.7
ββ trame_vtk 2.5.8
ββ trame_vuetify 2.3.1
ββ unavailable ipympl
Ecosystem (optional)
ββ mne-bids 0.13
ββ mne-nirs 0.5.0
ββ mne-features 0.3
ββ mne-connectivity 0.5.0
ββ mne-icalabel 0.4
ββ mne-bids-pipeline 1.4.0
Then again running it after restarting MNE, again I can only plot on the pane, cannot interact:
mne.sys_info()
Platform macOS-14.0-arm64-i386-64bit
Python 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:33:12) [Clang 15.0.7 ]
Executable /Applications/MNE-Python/1.5.1_0/.mne-python/bin/python
CPU i386 (10 cores)
Memory 16.0 GB
Core
ββ mne 1.5.1
ββ numpy 1.24.4 (OpenBLAS 0.3.24 with 10 threads)
ββ scipy 1.11.2
ββ matplotlib 3.7.2 (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.0.1
ββ nilearn 0.10.1
ββ dipy 1.7.0
ββ openmeeg 2.5.6
ββ pandas 2.1.0
ββ unavailable cupy
Visualization (optional)
ββ pyvista 0.41.1 (OpenGL 4.1 Metal - 86 via Apple M1 Pro)
ββ pyvistaqt 0.0.0
ββ vtk 9.2.6
ββ qtpy 2.4.0 (PyQt5=5.15.8)
ββ ipympl 0.9.3
ββ pyqtgraph 0.13.3
ββ mne-qt-browser 0.5.2
ββ ipywidgets 8.1.0
ββ trame_client 2.11.2
ββ trame_server 2.11.7
ββ trame_vtk 2.5.8
ββ trame_vuetify 2.3.1
Ecosystem (optional)
ββ mne-bids 0.13
ββ mne-nirs 0.5.0
ββ mne-features 0.3
ββ mne-connectivity 0.5.0
ββ mne-icalabel 0.4
ββ mne-bids-pipeline 1.4.0
heartbeat_evoked_v1.plot()
Traceback (most recent call last):
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/IPython/core/formatters.py:340 in __call__
return printer(obj)
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/IPython/core/pylabtools.py:152 in print_figure
fig.canvas.print_figure(bytes_io, **kw)
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/backend_bases.py:2353 in print_figure
restore_bbox = _tight_bbox.adjust_bbox(
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/_tight_bbox.py:28 in adjust_bbox
ax.apply_aspect(locator(ax, None))
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/mpl_toolkits/axes_grid1/inset_locator.py:73 in __call__
bbox = self.get_window_extent(renderer)
File /Applications/MNE-Python/1.5.1_0/.mne-python/lib/python3.11/site-packages/matplotlib/offsetbox.py:399 in get_window_extent
renderer = self.figure._get_renderer()
AttributeError: 'NoneType' object has no attribute '_get_renderer'
Out[11]: <Figure size 460.8x216 with 2 Axes>
In general, which backend would you recommend to stick to? I kept switching when one stopped working (plots not appearing at all, or only appearing on the console), but ideally, I would like to stick to one and ensure it keeps workingβ¦
I presume I might have used the standalone installer back then, but cannot remember certainly. I am using MNE Spyder.
I feel very stuck at this moment since all my attempts to fix it reached a dead end, thankful to hear your tips!
Best,
Deniz