If you have a question or issue with MNE-Python, please include the following info:
MNE-Python version: 0.22.1
Python: 3.9.2
operating system: Mac OS 10.15.7
Please also provide relevant code snippets – ideally a minimal working example (MWE). To get the correct formatting, paste your Python code, then select it, and click on the Preformatted text toolbar button.
Please edit or remove the above text before submitting your posting.
Hi everyone,
I am very new to MNE, sorry for my naive question.
I am trying to do a beamformer on my MEG data. So far I have used FreeSurfer to do fully automatic reconstruction on the T1 data. But I do not see any BEM data in the output.
I tried to use the function mne.bem.make_watershed_bem(), but I got this error:
Traceback (most recent call last):
File "<ipython-input-30-5a9ec101536f>", line 1, in <module>
mne.bem.make_watershed_bem(subject)
File "<decorator-gen-97>", line 24, in make_watershed_bem
File "/Users/andrewchang/opt/anaconda3/envs/mne/lib/python3.9/site-packages/mne/bem.py", line 1103, in make_watershed_bem
env, mri_dir, bem_dir = _prepare_env(subject, subjects_dir)
File "/Users/andrewchang/opt/anaconda3/envs/mne/lib/python3.9/site-packages/mne/bem.py", line 1630, in _prepare_env
fs_home = _check_freesurfer_home()
File "/Users/andrewchang/opt/anaconda3/envs/mne/lib/python3.9/site-packages/mne/utils/check.py", line 694, in _check_freesurfer_home
raise RuntimeError(
RuntimeError: The FREESURFER_HOME environment variable is not set.
Thank you very much for your reply @richard !
But the freesurfer message won’t automatically pop-out when I open a terminal window. I have to manually enter the commands every time to have the output.
Does it mean that the freesurfer was not properly installed?
I run the MNE-Python under Spyder under a conda environment “mne”.
I tried run the commends under both “base” and “mne” environment, but none of them work.
Thank you @richard , now the freesurfer output message will pop out when I open the terminal under zsh shell!
But the same “The FREESURFER_HOME environment variable is not set.” error message is still there…
Will that has anything to do with running the MNE-Python under Spyder under a conda environment “mne”?
I guess it depends on how you start Spyder …
If you open a terminal, activate the mne conda environment, and then run spyder from the same command line, all should be good (at least in theory)
I checked on Linux, and the spyder console is a bash console that has run .bashrc (I ran !env in spyder’s ipython console to look for env variables that I know are only defined if my .bashrc has been run). So you can check that (and also things like !echo $SHELL) to help you figure out if it’s possible to get it to work when launching spyder via GUI instead of from a terminal. But at least it works from a terminal
I’d like to follow up because I ran into the same error while initializing the coregistration GUI. However, the solution here doesn’t seem to work for me… I wonder if it’s because of how I installed MNE python and FreeSurfer on my Windows 10 machine:
I installed and ran FS 7.4.1 using a windows subsystem for Linux (WSL). It seems to work and I have created a bunch of subfolders (but no BEM folder) from each subject’s T1 scan. I was also able to visualize the .mgz file using orthoview(). Due to system restrictions I had to set the subject folder in the windows file system instead of the WSL.
I used the installer to install MNE python. I tried opening Spyder from the Prompt that was installed along with MNE thinking that this might be equivalent to activating the mne conda environment. But the error remains.
Would you have any insight about how I can fix this problem? Thanks!!
Thank you for the suggestion! It took me a while to resolve graphic and other issues with WSL but now it seems to be working. For the record, I now have MNE installed both in my WSL and in my main Windows system to do the following:
make the BEM folder for each subject under Linux. For some reason the coregistration GUI fails to open.
once the BEM folder has been made I go back to the windows system and continue with coregistration and following steps.