Error: FSLDIR is not set

I have a problem with running the 5ttgen command in my python script to premask the HCP data.
I used exactly the command from the manual:

5ttgen fsl T1w_acpc_dc_restore_brain.nii.gz 5TT.mif -premasked

But then this error appears:

5ttgen: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.
5ttgen:
5ttgen: Generated temporary directory: /tmp/5ttgen-tmp-RK5S80/
Command: mrconvert /home/ubuntu/E130-Daten/IngoHermann/111111/T1w/Diffusion/T1w_acpc_dc_restore_brain.nii.gz /tmp/5ttgen-tmp-RK5S80/input.mif
[ERROR] Environment variable FSLDIR is not set; please run appropriate FSL configuration script

I’m very new in this topic and I don’t know how to set the variable FSLDIR.
Thank you in advance!

And now a new error appears but I tried everything even this but I get this error.

[ERROR] Atlases required for FSL’s FIRST program not installed;
Please install fsl-first-data using your relevant package manager

And I finally solved it :smiley:

FSLDIR=/usr/share/fsl/5.0
. {FSLDIR}/etc/fslconf/fsl.sh PATH={FSLDIR}/bin:${PATH}
export FSLDIR PATH

I hope this helps also someone else !

1 Like

Hi @Ingo,

You probably don’t want to set the FSLDIR environment variable to contain the entire PATH in the fourth line of your example; the former should simply be the path to the FSL root directory, whereas the latter contains multiple paths corresponding to many non-FSL executable file locations. Not sure whether or not this may cause FSL commands to hiccup. It would be preferable to set FSLDIR to just the root FSL directory.

Cheers
Rob

Hi Rob,

I have a similar problem… I cant use the atlas tools in FSLeyes and the atlas tools panel says ´atlases are not available.´ This seems to be due to the location of the FSLDIR file… After installing and opening FSLeyes I got the message: FSLDIR environment variable is not set -FSLeyes may not behave correctly as described as an error on this page: https://users.fmrib.ox.ac.uk/~paulmc/fsleyes/userdoc/latest/troubleshooting.html#fsldir-is-not-set.

I told FSLeyes where FSL is located by clicking on the Locate $FSLDIR button, and selecting the FSL installation directory but unfortunately nothing changes.

Could you please advise me on this matter?

Thank you in advance.

Simone

Welcome Simone!

I cant use the atlas tools in FSLeyes and the atlas tools panel says ´atlases are not available.´

I know there are some older FSL installation pathways whereby the “core” FSL software would be installed via one package, but the atlas data were in a separate package that needed to be installed explicitly. Just mentioning in case that’s what’s happening here.

This seems to be due to the location of the FSLDIR file

To be clear, “FSLDIR” is not a file. It’s an “environment variable” that, in this case, allows any executed FSL command to quickly and easily know where FSL has been installed in order to locate any other resources it needs.

I told FSLeyes where FSL is located by clicking on the Locate $FSLDIR button, and selecting the FSL installation directory but unfortunately nothing changes.

I’ve never used FSLeyes, so I can only go by your explanation here, but it sounds like a temporary solution for attempting to run despite an incomplete installation. You should be setting FSLDIR and executing the relevant FSL setup script during shell startup so that you never have to worry about it again; I expect there to be instructions for this somewhere, but it’s not our software so out of our control.

Cheers
Rob