Unrecognized FS_LICENSE variable

Summary of what happened:

I’m running into an issue running the xcp-d-0.3.0 singularity image on my university cluster. The pipepline is failing at the following node: xcpd_wf.single_subject_SA204_wf.anatomical_wf.lh_sphere_raw_mris.

Command used (and if a helper script was used, a link to the helper script or the command generated):

#!/usr/bin/bash

# Example: bash xcp_d-0.3.0 sub-SA122 /home/brd2241/projects/b1145/bram/sa_rsfmri /home/brd2241/projects/b1145/bram/work

# Set input variables
XCP_d_VER=${1}
subject=${2}
BIDS_DIR=${3}
WORK_DIR=${4}

SLURM_NAME=${subject}.${XCP_d_VER}

# Make working directory
mkdir -p $WORK_DIR

# Make directory for slrum logs
mkdir -p ${BIDS_DIR}/code/slurm_logs/

# Ensure fmriprep is complete
FMRIPREP_JOBID=$(squeue -n ${subject}.fmriprep-22.0.0 | tail -n 1 | awk '{print $1}')

if [ ${FMRIPREP_JOBID} == "JOBID" ]; then
    DEPENDENCY=""
else
    echo "Waiting for fmriprep (Job ID: ${FMRIPREP_JOBID}) to finish..."
    DEPENDENCY="--dependency=afterok:${FMRIPREP_JOBID}"
fi

# Remove out/err logs when rerunning
rm -rf ${BIDS_DIR}/code/slurm_logs/*.${SLURM_NAME}

# Prepare FS_LICENSE; this file will be different for FSv51, but should work for FSv52+
FS_LICENSE=/projects/p30952/environment/software/freesurfer_v72/license.txt

echo "Submitting xcp_d sbatch for ${subject}"

sbatch ${DEPENDENCY} << EOT
#!/usr/bin/bash

#SBATCH --account=p30952
#SBATCH --partition=normal
#SBATCH --time=10:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=8
#SBATCH --mem=24G
#SBATCH --job-name=${SLURM_NAME}

# Outputs ----------------------------------
#SBATCH --mail-user=${email}
#SBATCH --mail-type=FAIL
#SBATCH --output=${BIDS_DIR}/code/slurm_logs/out.${SLURM_NAME}
#SBATCH --error=${BIDS_DIR}/code/slurm_logs/err.${SLURM_NAME}
# -----------------------------------------

# Load Modules
module purge
module load singularity
echo "Modules loaded"

# Do xcp_d
echo "Begin Preprocessing"

# d: FSFAST removes first 4 frames by default (2.8TR x 4s = 11.2s)
# dcan-qc creates executive QC report (all subjects)
# motion-filter notch is for respiratory artifacts [in BPM] (10-30 is best for > 80 yo; Fair et al. 2019)

singularity run \
	--cleanenv -B /projects \
	/projects/p30952/environment/singularity_images/${XCP_d_VER}.simg \
	--verbose \
	--participant_label ${subject} \
	--input-type fmriprep \
	--nthreads 12 \
	--mem_gb 24 \
	--smoothing 3 \
	--despike \
	--nuisance-regressors acompcor_gsr \
	-d 11.2 \
	--bpf-order 2 \
        --motion-filter-type notch \
        --band-stop-min 10 \
        --band-stop-max 30 \
        --lower-bpf 0.01 \
	--upper-bpf 0.1 \
	--fd-thresh 0.4 \
        --dcan-qc \
        --cifti \
        --warp-surfaces-native2std \
	--work_dir ~/projects/b1145/bram/work \
	${BIDS_DIR}/derivatives/fmriprep-22.0.0 \
	${BIDS_DIR}/derivatives/${XCP_d_VER} \
        participant

exit 0

EOT

Version:

0.3.0

Environment (Docker, Singularity, custom installation):

Singularity

Data formatted according to a validatable standard? Please provide the output of the validator:

Relevant log outputs (up to 20 lines):

Please see the attached slurm ouput (80.0 KB) and crashfile crashfile (4.0 KB). The program is attempting to run mri_covert , but unable to because it’s looking for the FS license in /opt/freesurfer/license.txt instead of checking $FS_LICENSE . I define $FS_LICENSE in my SBATCH command. This has not been an issue before.

Screenshots / relevant information:

Notably, the pipeline ran to completion before adding the following options:

        --dcan-qc \
        --cifti \
        --warp-surfaces-native2std \

Thanks! I appreciate the help.

Cheers,
Bram

Hi,

You can bind your license file to /opt/freesurfer/license.txt by changing your singularity bind string argument. -B /projects,$FS_LICENSE:/opt/freesurfer/license.txt.

Alternatively, for an environmental variable such as FS_LICENSE to be found in a singularity container, you would need to define it as SINGULARITYENV_FS_LICENSE.

Best,
Steven

Hi @Steven,

I’m a bit confused. My FS license is here: /projects/p30952/environment/software/freesurfer_v72/license.txt and I don’t have access to /opt/freesurfer/ on the cluster.

Should I do the following:
-B /projects,$FS_LICENSE:/projects/p30952/environment/software/freesurfer_v72/license.txt \

Thanks,
Bram

No, the command I wrote in the last answer binds your fs license at the specified location in the container.

1 Like