Unable to add new annotation description in raw browser


I’m having problems adding a new annotation description using the annotations toolbar. When I click “Add Description”, I see the “New Description” dialogue appear briefly, but then it disappears. After this, I can’t interact with the raw browser at all - can’t even bring it in front of other windows by clicking on it. It’s almost like the New Description dialogue is still in front of it, but invisible. Has anyone else had this problem?


  • MNE version: 1.0.2
  • operating system: Windows 10

Hello @amyt and welcome to the forum!

How did you install MNE?

Could you please post the output of

import mne

How do you open up / start the plotting window (exact line of code)?

Best wishes,

cc @marsipu

Hi @richard, thanks for your reply,

I installed MNE using the standalone installer.

Here’s the output from mne.sys_info()

Platform:         Windows-10-10.0.19042-SP0
Python:           3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:34:17) [MSC v.1929 64 bit (AMD64)]
Executable:       C:\Users\k1891116\AppData\Local\mne-py\1.0.2_0\python.exe
CPU:              Intel64 Family 6 Model 142 Stepping 12, GenuineIntel: 8 cores
Memory:           15.8 GB

mne:              1.0.2
numpy:            1.21.6 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy:            1.8.0
matplotlib:       3.5.1 {backend=module://matplotlib_inline.backend_inline}

sklearn:          1.0.2
numba:            0.55.1
nibabel:          3.2.2
nilearn:          0.9.1
dipy:             1.5.0
cupy:             Not found
pandas:           1.4.2
pyvista:          0.33.3 {OpenGL 4.5.0 - Build via Intel(R) UHD Graphics 620}
pyvistaqt:        0.9.0
ipyvtklink:       0.2.2
vtk:              9.1.0
PyQt5:            5.12.3
ipympl:           0.9.0
pooch:            v1.6.0

mne_bids:         0.10
mne_nirs:         0.2.1
mne_features:     0.2
mne_qt_browser:   0.3.0
mne_connectivity: 0.3

I started the plotting window using:

raw_filtered.plot(duration=16, n_channels=32)

Thanks for your help with this.

Best wishes,

1 Like

Hello Amy, thanks for the additional information!

Which development environment do you use to run your code? (Spyder, Jupyter, …)

Hi Richard. I’m using Spyder.

Edit: also, my OS is managed by my university’s IT department. Could that have something to do with it?

Can you run in the Spider Python console

%matplotlib qt 

before running your script? Does that change anything?

Unfortunately that didn’t help. Still the same problem!


Can you try

raw_filtered.plot(duration=16, n_channels=32, block=True)


cc @larsoner, the gist is we have a user with the latest MNE and qt-browser on Windows, and when they open the Annotations dialog, it appears briefly, then disappears, and after that an interaction with the browser is impossible.

No idea, maybe @marsipu could test on his Windows machine?

I tried to reproduce the issue but was not able to, inside and outside Spyder. I tested now on Windows 11, but I din’t run into this issue when I had still Windows 10 installed.

The dialogs which opens to add a new description is modal, which means that it opens and stays in front and prohibits interaction with the Main-Window until it’s closed.
It is unusual that the modal dialog disappears behind other windows, this should be managed by Qt and/or even Windows itself.

@amyt Could you run the following in Spyder please to test if the problem comes from the modal dialog:

import sys
from PyQt5.QtWidgets import QApplication, QInputDialog, QMainWindow, \
    QPushButton, QVBoxLayout, QWidget

class TestWindow(QMainWindow):
    def __init__(self):
        widget = QWidget()
        layout = QVBoxLayout()
        test_bt = QPushButton('Test modal dialog')

    def open_modal_dialog(self):
        QInputDialog.getText(self, 'Modal Dialog', 'This is a modal dialog!')

app = QApplication(sys.argv)
test_win = TestWindow()

Hi @marsipu, thanks for your thoughts on this. Seems like the modal dialog isn’t the problem, as your test runs fine.

Actually, @richard 's suggestion of running with block=True does work - the dialogue doesn’t disappear anymore and I’m able to add “bad” as a description and mark some segments. Also confirmed that the dialogue is still disappearing when not setting block=True.

My problem now is that the browser process doesn’t end when I close it, but only on the second try. I.e. if I start a fresh console and plot the data with block=True, then close the browser, the process ends fine. But then if I run the .plot function again (again with block=True), and close the window, the process doesn’t seem to end/the console is not responsive. Do you have any thoughts on this?

Thanks all for your continued help with this!

Hello! Can you try using both, matplotlib qt and block=True?

Hmm that seems to not make it able to end the process even the first time. Also, sometimes the data are shown with thick lines, but other times the browser opens with thin lines, not sure if this is a clue to something or unrelated. It doesn’t seem consistent with if I use matplotlib qt or not - that said, I think it never opens with thin lines unless I do use matplotlib qt. Also, I prefer the thin lines, so would be nice to make that stick!

And this is all from Spyder? What if you run the same script a) directly from the command line using python, and b) run the same script inside ipython, on the command line too?

Yes, all from spyder. To run from the command line, do I need to install MNE again via pip/conda?

Hello, you should have a shortcut to a “Prompt” next to the other MNE shortcuts. If you start this, it should put you on a command line with the MNE-Python Python environment properly initialized. From there, you can navigate to the folder containing your script (via cd) and run it e.g. via python myscript.py

Hi Richard. So when running the script a) from the command line, without block=True, the browser window just flashed up and exited. When running with block=True, it worked as it should - able to add an annotation description and mark some segments. The script ended when I closed the browser. Checked this a few times.

When running the script b) using ipython on the command line, without block=True, I have the original issue I reported of the “Add Description” dialogue disappearing quickly and I can’t interact with or close the browser. (Do you know the best way to close it and free up the memory if I didn’t want to exit out of ipython?) When running with block=True everything works fine! No hanging after closing the browser. Works successfully multiple times.

Thanks for your help so far!

Does this give you any more insight into what’s happening in Spyder? Great to have a working solution for now, but would be nice to be able to use Spyder for the plots tab etc.


Perfect, so this is working as intended!
(To prevent the browser from closing when using block=False, you need to run the script via python -i myscript.py; the -i is for “interactive mode”)

Ok, this is expected too!

The “hanging” when running in IPython with block=False should go away if you first run

%gui qt5

Can you try whether this also fixes your problem with Spyder?

Best wishes,

Okay, so %gui qt5 enabled me to use the Add Description dialogue successfully using ipython from the command line with block=False. But it didn’t fix it in Spyder, nor did it fix the script not quitting on closing the browser with block=True… I feel like we’re getting somewhere though?

1 Like

@marsipu @cbrnr @GuillaumeFavelier Any idea what might be happening here? It’s certainly to do with the Qt event loop, I suppose?