From 309a5ed1cd2581dc6b0e27f5dae6aba164a90ea9 Mon Sep 17 00:00:00 2001 From: Ayushi Satodiya Date: Tue, 28 Apr 2026 12:13:59 +0530 Subject: [PATCH 1/6] BUG: improve FreeSurfer error message in make_watershed_bem When mri_watershed is not found, raise a RuntimeError with clear guidance to check FREESURFER_HOME, PATH, and shell configuration. Closes #12917 Re-submission of #13790 --- doc/changes/dev/13790.bugfix.rst | 1 + doc/changes/names.inc | 3 --- mne/bem.py | 14 +++++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 doc/changes/dev/13790.bugfix.rst diff --git a/doc/changes/dev/13790.bugfix.rst b/doc/changes/dev/13790.bugfix.rst new file mode 100644 index 00000000000..f3c9cbcaba9 --- /dev/null +++ b/doc/changes/dev/13790.bugfix.rst @@ -0,0 +1 @@ +Improved error message when FreeSurfer executable is not found, by `Ayushi Satodiya`_. diff --git a/doc/changes/names.inc b/doc/changes/names.inc index b87dbbfb04c..ae54e268d67 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -172,7 +172,6 @@ .. _Jukka Nenonen: https://www.linkedin.com/pub/jukka-nenonen/28/b5a/684 .. _Jussi Nurminen: https://github.com/jjnurminen .. _Kaisu Lankinen: http://bishoplab.berkeley.edu/Kaisu.html -.. _Kalle Makela: https://github.com/Kallemakela .. _Katarina Slama: https://github.com/katarinaslama .. _Katia Al-Amir: https://github.com/katia-sentry .. _Kay Robbins: https://github.com/VisLab @@ -188,7 +187,6 @@ .. _Leonardo Barbosa: https://github.com/noreun .. _Leonardo Rochael Almeida: https://github.com/leorochael .. _Liberty Hamilton: https://github.com/libertyh -.. _Lifeng Qiu Lin: https://github.com/Gnefil .. _Lorenzo Desantis: https://github.com/lorenzo-desantis/ .. _Lukas Breuer: https://www.researchgate.net/profile/Lukas-Breuer-2 .. _Lukas Gemein: https://github.com/gemeinl @@ -258,7 +256,6 @@ .. _Paul Pasler: https://github.com/ppasler .. _Paul Roujansky: https://github.com/paulroujansky .. _Pavel Navratil: https://github.com/navrpa13 -.. _Pavel Popov: https://github.com/paavalipopov .. _Peter Molfese: https://github.com/pmolfese .. _Phillip Alday: https://palday.bitbucket.io .. _Pierre Ablin: https://pierreablin.com diff --git a/mne/bem.py b/mne/bem.py index 14538f7c272..c50478fb2ff 100644 --- a/mne/bem.py +++ b/mne/bem.py @@ -1313,7 +1313,19 @@ def make_watershed_bem( f"\nResults dir = {ws_dir}\nCommand = {' '.join(cmd)}\n" ) os.makedirs(op.join(ws_dir)) - run_subprocess_env(cmd) + try: + run_subprocess_env(cmd) + except FileNotFoundError as e: + raise RuntimeError( + "FreeSurfer executable 'mri_watershed' not found.\n\n" + "This usually means FreeSurfer is not properly configured.\n" + "Make sure:\n" + "- FREESURFER_HOME is set\n" + "- $FREESURFER_HOME/bin is in your PATH\n" + "- You started Python/Jupyter from a terminal where " + "SetupFreeSurfer.sh is sourced\n\n" + "See https://mne.tools/stable/install/index.html for details." + ) from e del tempdir # clean up directory if op.isfile(T1_mgz): new_info = _extract_volume_info(T1_mgz) From e2831340728372401f5cc998046fbd058673f48e Mon Sep 17 00:00:00 2001 From: Ayushi Satodiya Date: Tue, 28 Apr 2026 12:37:46 +0530 Subject: [PATCH 2/6] DOC: add contributor name to names.inc --- doc/changes/names.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changes/names.inc b/doc/changes/names.inc index ae54e268d67..856e25ee5fb 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -34,6 +34,7 @@ .. _Arne Pelzer: https://github.com/aplzr .. _Ashley Drew: https://github.com/ashdrew .. _Asish Panda: https://github.com/kaichogami +.. _Ayushi Satodiya: https://github.com/ayuclan .. _Austin Hurst: https://github.com/a-hurst .. _Beige Jin: https://github.com/BeiGeJin .. _Ben Beasley: https://github.com/musicinmybrain From 0d4f0843c2396e2e34f50576a47ec5d5b9e07b4b Mon Sep 17 00:00:00 2001 From: Ayushi Satodiya Date: Tue, 28 Apr 2026 17:21:53 +0530 Subject: [PATCH 3/6] DOC: restore accidentally deleted names.inc entries --- doc/changes/names.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changes/names.inc b/doc/changes/names.inc index 856e25ee5fb..721c0a08ca1 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -173,6 +173,7 @@ .. _Jukka Nenonen: https://www.linkedin.com/pub/jukka-nenonen/28/b5a/684 .. _Jussi Nurminen: https://github.com/jjnurminen .. _Kaisu Lankinen: http://bishoplab.berkeley.edu/Kaisu.html +.. _Kalle Makela: https://github.com/Kallemakela .. _Katarina Slama: https://github.com/katarinaslama .. _Katia Al-Amir: https://github.com/katia-sentry .. _Kay Robbins: https://github.com/VisLab @@ -187,6 +188,7 @@ .. _Laurent Le Mentec: https://github.com/LaurentLM .. _Leonardo Barbosa: https://github.com/noreun .. _Leonardo Rochael Almeida: https://github.com/leorochael +.. _Lifeng Qiu Lin: https://github.com/Gnefil .. _Liberty Hamilton: https://github.com/libertyh .. _Lorenzo Desantis: https://github.com/lorenzo-desantis/ .. _Lukas Breuer: https://www.researchgate.net/profile/Lukas-Breuer-2 @@ -257,6 +259,7 @@ .. _Paul Pasler: https://github.com/ppasler .. _Paul Roujansky: https://github.com/paulroujansky .. _Pavel Navratil: https://github.com/navrpa13 +.. _Pavel Popov: https://github.com/paavalipopov .. _Peter Molfese: https://github.com/pmolfese .. _Phillip Alday: https://palday.bitbucket.io .. _Pierre Ablin: https://pierreablin.com From 11cc63c821eac757a59b3513752c9c8c23f9ee87 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 11:53:21 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/changes/names.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changes/names.inc b/doc/changes/names.inc index 721c0a08ca1..d7349b1eac9 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -34,8 +34,8 @@ .. _Arne Pelzer: https://github.com/aplzr .. _Ashley Drew: https://github.com/ashdrew .. _Asish Panda: https://github.com/kaichogami -.. _Ayushi Satodiya: https://github.com/ayuclan .. _Austin Hurst: https://github.com/a-hurst +.. _Ayushi Satodiya: https://github.com/ayuclan .. _Beige Jin: https://github.com/BeiGeJin .. _Ben Beasley: https://github.com/musicinmybrain .. _Benedikt Ehinger: https://www.benediktehinger.de @@ -188,8 +188,8 @@ .. _Laurent Le Mentec: https://github.com/LaurentLM .. _Leonardo Barbosa: https://github.com/noreun .. _Leonardo Rochael Almeida: https://github.com/leorochael -.. _Lifeng Qiu Lin: https://github.com/Gnefil .. _Liberty Hamilton: https://github.com/libertyh +.. _Lifeng Qiu Lin: https://github.com/Gnefil .. _Lorenzo Desantis: https://github.com/lorenzo-desantis/ .. _Lukas Breuer: https://www.researchgate.net/profile/Lukas-Breuer-2 .. _Lukas Gemein: https://github.com/gemeinl From e6b67941d6326413219b430e9d113857ae97358c Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 28 Apr 2026 10:55:17 -0400 Subject: [PATCH 5/6] Add 13874 bugfix documentation --- doc/changes/dev/{13790.bugfix.rst => 13874.bugfix.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/changes/dev/{13790.bugfix.rst => 13874.bugfix.rst} (100%) diff --git a/doc/changes/dev/13790.bugfix.rst b/doc/changes/dev/13874.bugfix.rst similarity index 100% rename from doc/changes/dev/13790.bugfix.rst rename to doc/changes/dev/13874.bugfix.rst From b842c1b5002fec80a513bae3b095aa5e8816eaf4 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 28 Apr 2026 10:55:48 -0400 Subject: [PATCH 6/6] Update contributor notation in error message --- doc/changes/dev/13874.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes/dev/13874.bugfix.rst b/doc/changes/dev/13874.bugfix.rst index f3c9cbcaba9..209e509da6f 100644 --- a/doc/changes/dev/13874.bugfix.rst +++ b/doc/changes/dev/13874.bugfix.rst @@ -1 +1 @@ -Improved error message when FreeSurfer executable is not found, by `Ayushi Satodiya`_. +Improved error message when FreeSurfer executable is not found, by :newcontrib:`Ayushi Satodiya`.