ModuleNotFoundError in Overview of MEG/EEG analysis with MNE-Python

  • MNE version: 1.3.1
  • operating system: macOS 12.5.1

I am using this tutorial: Overview of MEG/EEG analysis with MNE-Python — MNE 1.4.1 documentation

and when I do:
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = (
sample_data_folder / “MEG” / “sample” / “sample_audvis_filt-0-40_raw.fif”
)
raw = mne.io.read_raw_fif(sample_data_raw_file)

it says:
ModuleNotFoundError Traceback (most recent call last)
Cell In[2], line 1
----> 1 sample_data_folder = mne.datasets.sample.data_path()
2 sample_data_raw_file = (
3 sample_data_folder / “MEG” / “sample” / “sample_audvis_filt-0-40_raw.fif”
4 )
5 raw = mne.io.read_raw_fif(sample_data_raw_file)

File :12, in data_path(path, force_update, update_path, download, verbose)

File /lib/python3.11/site-packages/mne/datasets/sample/sample.py:14, in data_path(path, force_update, update_path, download, verbose)
11 @verbose
12 def data_path(path=None, force_update=False, update_path=True,
13 download=True, *, verbose=None): # noqa: D103
—> 14 return _download_mne_dataset(
15 name=‘sample’, processor=‘untar’, path=path,
16 force_update=force_update, update_path=update_path,
17 download=download)

File /lib/python3.11/site-packages/mne/datasets/utils.py:195, in _download_mne_dataset(name, processor, path, force_update, update_path, download, accept)
192 def _download_mne_dataset(name, processor, path, force_update,
193 update_path, download, accept=False):
194 “”“Aux function for downloading internal MNE datasets.”“”
→ 195 import pooch
196 from mne.datasets._fetch import fetch_dataset
198 _check_in_testing_and_raise(name, download)

ModuleNotFoundError: No module named ‘pooch’

what is happening?

Your Python environment is missing the pooch package. Depending on how you installed MNE-Python, you need to pip install pooch or conda install pooch.

I already did that and nothing changed.

This is what I got after doing pip install pooch:

Requirement already satisfied: pooch in ./opt/anaconda3/lib/python3.9/site-packages (1.7.0)

Requirement already satisfied: packaging>=20.0 in ./opt/anaconda3/lib/python3.9/site-packages (from pooch) (21.3)

Requirement already satisfied: requests>=2.19.0 in ./opt/anaconda3/lib/python3.9/site-packages (from pooch) (2.28.1)

Requirement already satisfied: platformdirs>=2.5.0 in ./opt/anaconda3/lib/python3.9/site-packages (from pooch) (2.5.2)

Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in ./opt/anaconda3/lib/python3.9/site-packages (from packaging>=20.0->pooch) (3.0.9)

Requirement already satisfied: idna<4,>=2.5 in ./opt/anaconda3/lib/python3.9/site-packages (from requests>=2.19.0->pooch) (3.3)

Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./opt/anaconda3/lib/python3.9/site-packages (from requests>=2.19.0->pooch) (1.26.11)

Requirement already satisfied: certifi>=2017.4.17 in ./opt/anaconda3/lib/python3.9/site-packages (from requests>=2.19.0->pooch) (2022.9.24)

Requirement already satisfied: charset-normalizer<3,>=2 in ./opt/anaconda3/lib/python3.9/site-packages (from requests>=2.19.0->pooch) (2.0.4)

What now?

Then you are probably not in the correct environment. In your script, can you please run mne.sys_info() and post the output here?

1 Like

Platform: Emscripten-3.1.32-wasm32-32bit
Python: 3.11.2 (main, Mar 30 2023, 21:37:59) [Clang 17.0.0 (GitHub - llvm/llvm-project: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org. df82394e7a2d06506718cafa347b
Executable: /home/pyodide/this.program
CPU: : 1 cores
Memory: Unavailable (requires “psutil” package)
mne: 1.3.1
numpy: 1.24.2 {unknown linalg bindings (threadpoolctl module not found: The module ‘threadpoolctl’ is included in the Pyodide distribution, but it is not installed.
You can install it by calling:
await micropip.install(“threadpoolctl”) in Python, or
await pyodide.loadPackage(“threadpoolctl”) in JavaScript
See Loading packages — Version 0.23.2 for more details.)}
scipy: 1.9.3
matplotlib: Not found

sklearn: Not found
numba: Not found
nibabel: Not found
nilearn: Not found
dipy: Not found
openmeeg: Not found
cupy: Not found
pandas: Not found
pyvista: Not found
pyvistaqt: Not found
ipyvtklink: Not found
vtk: Not found
qtpy: Not found
ipympl: Not found
pyqtgraph: Not found
pooch: Not found

mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: Not found
mne_connectivity: Not found
mne_icalabel: Not found

This output shows that you don’t have pooch (and many other packages) installed. Are you intentionally running MNE-Python on Pyodide (AFAIK we don’t officially support it)? You need to install the packages inside the correct environment, in your previous post you seem to have installed pooch in another (conda) env.