Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Braindecode is not working with mne 1.7.1 #598

Open
bruAristimunha opened this issue Apr 30, 2024 · 3 comments
Open

Braindecode is not working with mne 1.7.1 #598

bruAristimunha opened this issue Apr 30, 2024 · 3 comments
Assignees

Comments

@bruAristimunha
Copy link
Collaborator

We need to do a new release because, for some functions, the import changed place with the pre-processing function.

below the traceback

>>> import braindecode
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bru/mambaforge/lib/python3.10/site-packages/braindecode/__init__.py", line 3, in <module>
    from .classifier import EEGClassifier
  File "/home/bru/mambaforge/lib/python3.10/site-packages/braindecode/classifier.py", line 17, in <module>
    from .eegneuralnet import _EEGNeuralNet
  File "/home/bru/mambaforge/lib/python3.10/site-packages/braindecode/eegneuralnet.py", line 25, in <module>
    from .datasets.base import BaseConcatDataset, WindowsDataset
  File "/home/bru/mambaforge/lib/python3.10/site-packages/braindecode/datasets/__init__.py", line 6, in <module>
    from .moabb import MOABBDataset, HGD, BNCI2014001
  File "/home/bru/mambaforge/lib/python3.10/site-packages/braindecode/datasets/moabb.py", line 152, in <module>
    class BNCI2014001(MOABBDataset):
  File "/home/bru/mambaforge/lib/python3.10/site-packages/braindecode/datasets/moabb.py", line 162, in BNCI2014001
    from moabb.datasets import BNCI2014001
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/__init__.py", line 4, in <module>
    from .benchmark import benchmark
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/benchmark.py", line 10, in <module>
    from moabb import paradigms as moabb_paradigms
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/paradigms/__init__.py", line 10, in <module>
    from moabb.paradigms.cvep import *
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/paradigms/cvep.py", line 5, in <module>
    from moabb.datasets import utils
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/datasets/__init__.py", line 10, in <module>
    from . import compound_dataset
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/datasets/compound_dataset/__init__.py", line 2, in <module>
    from .base import CompoundDataset
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/datasets/compound_dataset/base.py", line 5, in <module>
    from ..base import BaseDataset
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/datasets/base.py", line 14, in <module>
    from moabb.datasets.bids_interface import StepType, _interface_map
  File "/home/bru/mambaforge/lib/python3.10/site-packages/moabb/datasets/bids_interface.py", line 26, in <module>
    import mne_bids
  File "/home/bru/mambaforge/lib/python3.10/site-packages/mne_bids/__init__.py", line 5, in <module>
    from mne_bids.report import make_report
  File "/home/bru/mambaforge/lib/python3.10/site-packages/mne_bids/report/__init__.py", line 3, in <module>
    from ._report import make_report
  File "/home/bru/mambaforge/lib/python3.10/site-packages/mne_bids/report/_report.py", line 16, in <module>
    from mne_bids.path import (
  File "/home/bru/mambaforge/lib/python3.10/site-packages/mne_bids/path.py", line 33, in <module>
    from mne_bids.utils import (
  File "/home/bru/mambaforge/lib/python3.10/site-packages/mne_bids/utils.py", line 19, in <module>
    from mne.io.pick import pick_types
ImportError: cannot import name 'pick_types' from 'mne.io.pick' (/home/bru/mambaforge/lib/python3.10/site-packages/mne/io/pick.py)
@MohammadJavadD
Copy link
Contributor

A temporary solution:
pip uninstall mne
pip install mne==1.6.1

@brunaafl
Copy link
Collaborator

brunaafl commented May 8, 2024

Hi! As I could understand, the issue of Braindecode and mne 1.7 is directly related to the issue with moabb and mne 1.7.

If moabb is not installed, there is interestingly no issue when importing Braindecode with mne 1.7. I imagined this updated version it could cause some incompatibility issues at preprocessing.mne_preprocessing.py since some processing functions were removed from mne.io.pick. However, the preprocessing was not using them directly, but from io.Raw methods.

The curious part is that, using mne 1.6.1 returns the following bootstrap warning, even though the functions are not being used:

>>> import braindecode
<frozen importlib._bootstrap>:241: FutureWarning: mne.io.pick.pick_types is deprecated will be removed in 1.6, use documented public API instead. If no appropriate public API exists, please open an issue on GitHub.
<frozen importlib._bootstrap>:241: FutureWarning: mne.io.pick.pick_channels_regexp is deprecated will be removed in 1.6, use documented public API instead. If no appropriate public API exists, please open an issue on GitHub.
<frozen importlib._bootstrap>:241: FutureWarning: mne.io.pick.channel_type is deprecated will be removed in 1.6, use documented public API instead. If no appropriate public API exists, please open an issue on GitHub.

If moabb is not installed, and mne==1.7:

(test_mne) brunalopes@brunalopes-Inspiron-15-3511:~$ pip uninstall moabb
Found existing installation: moabb 1.0.0
Uninstalling moabb-1.0.0:
  Would remove:
    /home/brunalopes/test_mne/lib/python3.10/site-packages/moabb-1.0.0.dist-info/*
    /home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/*
Proceed (Y/n)? y
  Successfully uninstalled moabb-1.0.0
(test_mne) brunalopes@brunalopes-Inspiron-15-3511:~$ python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import braindecode
>>> 

Just importing braindecode does not generate error.

If moabb is installed, and mne==1.7:

>>> import braindecode
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/braindecode/__init__.py", line 3, in <module>
    from .classifier import EEGClassifier
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/braindecode/classifier.py", line 17, in <module>
    from .eegneuralnet import _EEGNeuralNet
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/braindecode/eegneuralnet.py", line 22, in <module>
    from .datasets.base import BaseConcatDataset, WindowsDataset
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/braindecode/datasets/__init__.py", line 5, in <module>
    from .moabb import MOABBDataset, HGD, BNCI2014001
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/braindecode/datasets/moabb.py", line 114, in <module>
    class BNCI2014001(MOABBDataset):
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/braindecode/datasets/moabb.py", line 124, in BNCI2014001
    from moabb.datasets import BNCI2014001
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/__init__.py", line 4, in <module>
    from .benchmark import benchmark
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/benchmark.py", line 10, in <module>
    from moabb import paradigms as moabb_paradigms
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/paradigms/__init__.py", line 9, in <module>
    from moabb.paradigms.cvep import *
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/paradigms/cvep.py", line 5, in <module>
    from moabb.datasets import utils
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/datasets/__init__.py", line 9, in <module>
    from . import compound_dataset
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/datasets/compound_dataset/__init__.py", line 2, in <module>
    from .base import CompoundDataset
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/datasets/compound_dataset/base.py", line 5, in <module>
    from ..base import BaseDataset
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/datasets/base.py", line 13, in <module>
    from moabb.datasets.bids_interface import StepType, _interface_map
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/moabb/datasets/bids_interface.py", line 26, in <module>
    import mne_bids
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/mne_bids/__init__.py", line 5, in <module>
    from mne_bids.report import make_report
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/mne_bids/report/__init__.py", line 3, in <module>
    from ._report import make_report
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/mne_bids/report/_report.py", line 16, in <module>
    from mne_bids.path import (
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/mne_bids/path.py", line 33, in <module>
    from mne_bids.utils import (
  File "/home/brunalopes/test_mne/lib/python3.10/site-packages/mne_bids/utils.py", line 19, in <module>
    from mne.io.pick import pick_types
ImportError: cannot import name 'pick_types' from 'mne.io.pick' (/home/brunalopes/test_mne/lib/python3.10/site-packages/mne/io/pick.py)

This error is from moabb and is mentioned on the issue NeuroTechX/moabb#581 (comment) and pr NeuroTechX/moabb#586 (comment). It is due to an incompatibility between mne_bids
version 0.13 and mne 1.7.

The problem is: mne_bids 0.14 is still incompatible with mne 1.7 because of differences in handling writing files in EDF format.

@bruAristimunha
Copy link
Collaborator Author

Amazing study @brunaafl!

If I understand correctly, until mne_bids releases it, we cannot update the MNE version in braindecode due to Moabb which has MNE bids integrated into the base of all datasets.

What mne version do you recommend leaving in braindecode? 1.5 or 1.6?

Another alternative to avoid having any technical debt, @agramfort, can you make magic and make the mne bids release? 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants