Fail to bind or access outside PATH within apptainer container FS_QC

49 Views Asked by At

I am running the fs_qc toolbox (https://github.com/Deep-MI/fsqc) using apptainer on a slurm server. All modules within the container are executed fine, except for the shape module which requires a working FreeSurfer installation. The documentation for running the toolbox in a normal way (not in a container) states: "Also make sure that FreeSurfer is sourced (i.e., FREESURFER_HOME is set as an environment variable) before running an analysis." How do I do this when running the command using apptainer?

The errors I get shows that the FreeSurfer command cannot be performed, because inside the container cannot find the $PATH. I have tried binding the path before running the container command (as explained here https://apptainer.org/docs/user/main/bind_paths_and_mounts.html), but am not sure if this is the right way to do this.

I tried:

export APPTAINER_BIND=/path/to/FreeSurfer/

The command to run fs_qc using apptainer is:

apptainer run --bind /path/to/data/:/data_fsqc \
fsqc-latest.sif \
<--some required flags>
<--some other required flags>

The error I get from FS QC (after succesfully executing some of the earlier modules) is:

Failed to execute the following command:
mri_binarize -version
The following exception was raised:
[Errno 2] No such file or directory: 'mri_binarize'
[ERROR: fsqcMain.py: 1677]: ERROR: the shape module failed for subject sub-02
[ERROR: fsqcMain.py: 1678]: Reason: Failed to run FreeSurfer command, please check the required binaries are included in your $PATH.
0

There are 0 best solutions below