Trouble running ICA_AROMA; KeyError: 'FSLDIR'

Hello all,

I’m a bit perplexed trying to run ICA_AROMA. I’ve installed the python and fsl dependencies, but when I run my command:

sudo python2.7 -feat /mnt/c/Users/Ben/Desktop/test_asl_pipeline/003/analysis.feat/ -out /mnt/c/Users/Ben/Desktop/test_asl_pipeline/003/analysis.feat/ICA_AROMA/ -overwrite

I am getting an error:

Traceback (most recent call last):
File “”, line 145, in
fslDir = os.path.join(os.environ[“FSLDIR”], ‘bin’, ‘’)
File “/usr/lib/python2.7/”, line 40, in getitem
raise KeyError(key)
KeyError: ‘FSLDIR’

I assumed that my environment was set up incorrectly, but $FSLDIR gives me /usr/share/fsl/5.0/bin.

If I go into python2.7 and try:

import os
fslDir = os.path.join(os.environ[“FSLDIR”], ‘bin’, ‘’)

I get


Do you have any ideas about what is causing the error?

I’d say your user and root have different environments (i.e. FSLDIR is not defined for root).

Please remove that sudo from the python call.

1 Like

Yes, exactly. Thank you so much.