Closed adswa closed 2 years ago
Yes, we took the same approach as mne-qt-browser
: install qtpy
but don't install one of the 4 possibles qt bindings
. c.f. their requirement file. It is up to the user to install in the environment one of PyQt5
, PyQt6
, PySide2
, or Pyside6
.
The difference with mne-qt-browser
is that we raise if the bindings are missing, while the browser will swap the backend to matplotlib
.
The error message should be improved, it's not super explicit, and maybe also let's add a note in the tutorial. Would that be acceptable to resolve this issue?
The error message should be improved, it's not super explicit, and maybe also let's add a note in the tutorial. Would that be acceptable to resolve this issue?
sure. thanks for the delineation. :)
Describe the bug
Invoking the GUI after an installation of
mne-icalabel[gui]
via pip on a Windows 11 and Debian bookworm machine in a fresh Python 3.9 environment fails with anInstalling PyQt5 resolves the error.
Steps to reproduce
On both machines, I performed the following installations:
and then followed the tutorial exactly. Here is the outcome
click to expand Windows CMD
```python C:\Users\adina\repos>pip install mne-icalabel[gui] Requirement already satisfied: mne-icalabel[gui] in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (0.3.1) Requirement already satisfied: pooch in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne-icalabel[gui]) (1.6.0) Requirement already satisfied: torch in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne-icalabel[gui]) (1.12.1) Requirement already satisfied: mne>=1.1 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne-icalabel[gui]) (1.1.0) Requirement already satisfied: numpy>=1.16.0 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne-icalabel[gui]) (1.23.2) Requirement already satisfied: scipy>=1.2.0 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne-icalabel[gui]) (1.9.0) Collecting qtpy Downloading QtPy-2.2.0-py3-none-any.whl (82 kB) |████████████████████████████████| 82 kB 2.9 MB/s Collecting mne-qt-browser Downloading mne_qt_browser-0.3.1-py3-none-any.whl (70 kB) |████████████████████████████████| 70 kB 4.5 MB/s Requirement already satisfied: matplotlib in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne-icalabel[gui]) (3.5.3) Requirement already satisfied: decorator in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne>=1.1->mne-icalabel[gui]) (5.1.1) Requirement already satisfied: jinja2 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne>=1.1->mne-icalabel[gui]) (3.1.2) Requirement already satisfied: packaging in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne>=1.1->mne-icalabel[gui]) (21.3) Requirement already satisfied: tqdm in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from mne>=1.1->mne-icalabel[gui]) (4.62.3) Requirement already satisfied: appdirs>=1.3.0 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from pooch->mne-icalabel[gui]) (1.4.4) Requirement already satisfied: requests>=2.19.0 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from pooch->mne-icalabel[gui]) (2.27.1) Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from packaging->mne>=1.1->mne-icalabel[gui]) (3.0.9) Requirement already satisfied: certifi>=2017.4.17 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.19.0->pooch->mne-icalabel[gui]) (2021.10.8) Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.19.0->pooch->mne-icalabel[gui]) (2.0.7) Requirement already satisfied: idna<4,>=2.5 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.19.0->pooch->mne-icalabel[gui]) (3.3) Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.19.0->pooch->mne-icalabel[gui]) (1.26.7) Requirement already satisfied: MarkupSafe>=2.0 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from jinja2->mne>=1.1->mne-icalabel[gui]) (2.1.1) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->mne-icalabel[gui]) (1.4.4) Requirement already satisfied: cycler>=0.10 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->mne-icalabel[gui]) (0.11.0) Requirement already satisfied: pillow>=6.2.0 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->mne-icalabel[gui]) (9.2.0) Requirement already satisfied: python-dateutil>=2.7 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->mne-icalabel[gui]) (2.8.2) Requirement already satisfied: fonttools>=4.22.0 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->mne-icalabel[gui]) (4.36.0) Requirement already satisfied: six>=1.5 in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from python-dateutil>=2.7->matplotlib->mne-icalabel[gui]) (1.16.0) Collecting colorspacious Downloading colorspacious-1.1.2-py2.py3-none-any.whl (37 kB) Collecting scooby Downloading scooby-0.6.0-py3-none-any.whl (14 kB) Collecting qdarkstyle Downloading QDarkStyle-3.1-py2.py3-none-any.whl (870 kB) |████████████████████████████████| 870 kB 6.8 MB/s Collecting darkdetect Downloading darkdetect-0.7.1-py2.py3-none-any.whl (8.2 kB) Collecting pyqtgraph>=0.12.3 Downloading pyqtgraph-0.12.4-py3-none-any.whl (995 kB) |████████████████████████████████| 995 kB 3.2 MB/s Requirement already satisfied: typing-extensions in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from torch->mne-icalabel[gui]) (4.3.0) Requirement already satisfied: colorama in c:\users\adina\appdata\local\programs\python\python39\lib\site-packages (from tqdm->mne>=1.1->mne-icalabel[gui]) (0.4.4) Installing collected packages: qtpy, scooby, qdarkstyle, pyqtgraph, darkdetect, colorspacious, mne-qt-browser Successfully installed colorspacious-1.1.2 darkdetect-0.7.1 mne-qt-browser-0.3.1 pyqtgraph-0.12.4 qdarkstyle-3.1 qtpy-2.2.0 scooby-0.6.0 WARNING: You are using pip version 21.2.4; however, version 22.2.2 is available. You should consider upgrading via the 'C:\Users\adina\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command. C:\Users\adina\repos>ipython Python 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import os ...: ...: import mne ...: from mne.preprocessing import ICA ...: ...: from mne_icalabel.gui import label_ica_components In [2]: sample_data_folder = mne.datasets.sample.data_path() ...: sample_data_raw_file = os.path.join( ...: sample_data_folder, "MEG", "sample", "sample_audvis_filt-0-40_raw.fif" ...: ) ...: raw = mne.io.read_raw_fif(sample_data_raw_file) ...: ...: # Here we'll crop to 60 seconds and drop gradiometer channels for speed ...: raw.crop(tmax=60.0).pick_types(meg="mag", eeg=True, stim=True, eog=True) ...: raw.load_data() Opening raw data file C:\Users\adina\mne_data\MNE-sample-data\MEG\sample\sample_audvis_filt-0-40_raw.fif... Read a total of 4 projection items: PCA-v1 (1 x 102) idle PCA-v2 (1 x 102) idle PCA-v3 (1 x 102) idle Average EEG reference (1 x 60) idle Range : 6450 ... 48149 = 42.956 ... 320.665 secs Ready. Reading 0 ... 9009 = 0.000 ... 59.999 secs... Out[2]:click to expand Linux zsh
``` (joss) adina@muninn in ~/repos/mne-icalabel on git:main! ❱ ipython Python 3.9.12 (main, Mar 24 2022, 13:02:21) Type 'copyright', 'credits' or 'license' for more information IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import os ...: ...: import mne ...: from mne.preprocessing import ICA ...: ...: from mne_icalabel.gui import label_ica_components In [2]: sample_data_folder = mne.datasets.sample.data_path() ...: sample_data_raw_file = os.path.join( ...: sample_data_folder, "MEG", "sample", "sample_audvis_filt-0-40_raw.fif" ...: ) ...: raw = mne.io.read_raw_fif(sample_data_raw_file) ...: ...: # Here we'll crop to 60 seconds and drop gradiometer channels for speed ...: raw.crop(tmax=60.0).pick_types(meg="mag", eeg=True, stim=True, eog=True) ...: raw.load_data() Opening raw data file /home/adina/mne_data/MNE-sample-data/MEG/sample/sample_audvis_filt-0-40_raw.fif... Read a total of 4 projection items: PCA-v1 (1 x 102) idle PCA-v2 (1 x 102) idle PCA-v3 (1 x 102) idle Average EEG reference (1 x 60) idle Range : 6450 ... 48149 = 42.956 ... 320.665 secs Ready. Reading 0 ... 9009 = 0.000 ... 59.999 secs... Out[2]:Installing PyQt5, which currently isn't listed as a dependency for the
[gui]
components, solved the issue on both machines.