Hello
I am encountering issues launching mne-python after a first install on a new MacBookPro.
In Spyder console, the “import mne” command yields the errors message pasted below.
System info:
- MNE version: 1.9.0_0
- operating system: macOS 15,5(24F74)
- Spyder 6
In Spyder, the python interpreter is listed as follows:
/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/bin/python
Spyder console
- Python 3.12.7 | packaged by conda-forge | (main, Oct 4 2024, 15:57:01) [Clang 17.0.6 ]
Type “copyright”, “credits” or “license” for more information. - IPython 8.17.2 – An enhanced Interactive Python. Type ‘?’ for help.
import mne
ImportError Traceback (most recent call last)
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/init.py:24
23 try:
—> 24 from . import multiarray
25 except ImportError as exc:
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/multiarray.py:10
9 import functools
—> 10 from . import overrides
11 from . import _multiarray_umath
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/overrides.py:8
7 from .._utils._inspect import getargspec
----> 8 from numpy.core._multiarray_umath import (
9 add_docstring, _get_implementing_args, _ArrayFunctionDispatcher)
12 ARRAY_FUNCTIONS = set()
ImportError: dlopen(/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/_multiarray_umath.cpython-312-darwin.so, 0x0002): Library not loaded: @rpath/libgfortran.5.dylib
Referenced from: /Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/libopenblas.0.dylib
Reason: tried: ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/../../../../libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/../../../../libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/bin/../lib/libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/bin/../lib/libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/usr/local/lib/libgfortran.5.dylib’ (no such file), ‘/usr/lib/libgfortran.5.dylib’ (no such file, not in dyld cache)
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/init.py:130
129 try:
→ 130 from numpy.config import show as show_config
131 except ImportError as e:
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/config.py:4
3 from enum import Enum
----> 4 from numpy.core._multiarray_umath import (
5 cpu_features,
6 cpu_baseline,
7 cpu_dispatch,
8 )
10 all = [“show”]
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/init.py:50
27 msg = “”"
28
29 IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
(…)
48 “”" % (sys.version_info[0], sys.version_info[1], sys.executable,
49 version, exc)
—> 50 raise ImportError(msg)
51 finally:
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
- The Python version is: Python3.12 from “/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/bin/python”
- The NumPy version is: “1.26.4”
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: dlopen(/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/_multiarray_umath.cpython-312-darwin.so, 0x0002): Library not loaded: @rpath/libgfortran.5.dylib
Referenced from: /Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/libopenblas.0.dylib
Reason: tried: ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/../../../../libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/core/../../../../libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/bin/../lib/libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/Users/vv221713/Applications/MNE-Python/1.9.0_0/.mne-python/bin/../lib/libgfortran.5.dylib’ (duplicate LC_RPATH ‘@loader_path’), ‘/usr/local/lib/libgfortran.5.dylib’ (no such file), ‘/usr/lib/libgfortran.5.dylib’ (no such file, not in dyld cache)
The above exception was the direct cause of the following exception:
ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import mne
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/mne/init.py:35
32 # initialize logging
33 from .utils import set_log_level, set_log_file
—> 35 set_log_level(None, False)
36 set_log_file()
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/mne/utils/_logging.py:210, in set_log_level(verbose, return_old_level, add_frames)
189 “”“Set the logging level.
190
191 Parameters
(…)
207 The old level. Only returned if return_old_level
is True.
208 “””
209 old_verbose = logger.level
→ 210 verbose = _parse_verbose(verbose)
212 if verbose != old_verbose:
213 logger.setLevel(verbose)
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/mne/utils/_logging.py:225, in _parse_verbose(verbose)
224 def _parse_verbose(verbose):
→ 225 from .check import _check_option, _validate_type
226 from .config import get_config
228 _validate_type(verbose, (bool, str, int, None), “verbose”)
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/mne/utils/check.py:17
14 from inspect import signature
15 from pathlib import Path
—> 17 import numpy as np
19 from ..defaults import HEAD_SIZE_DEFAULT, _handle_default
20 from ..fixes import _compare_version, _median_complex
File ~/Applications/MNE-Python/1.9.0_0/.mne-python/lib/python3.12/site-packages/numpy/init.py:135
131 except ImportError as e:
132 msg = “”“Error importing numpy: you should not try to import numpy from
133 its source directory; please exit the numpy source tree, and relaunch
134 your python interpreter from there.”“”
→ 135 raise ImportError(msg) from e
137 all = [
138 ‘exceptions’, ‘ModuleDeprecationWarning’, ‘VisibleDeprecationWarning’,
139 ‘ComplexWarning’, ‘TooHardError’, ‘AxisError’]
141 # mapping of {name: (value, deprecation_msg)}
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
Important
It seems you’re trying to use a module that doesn’t come with our installer. Check this FAQ in our docs to learn how to do this.