Problems running Mindboggle with a Singularity Image

Summary of what happened:

Hi all,

I have been trying to run Mindboggle via my university’s HPC, which unfortunately only supports Singularity and not Docker. I tried all kinds of things, including implementing the things suggested on the Mindboggle website and the inputs of some of the previous people talking about Mindboggle and Singularity on here a while back. Creating the Singularity image was not an issue, but I’m having problems mounting to jovyan (mkdir -p $PWD/jovyan → “reader only permission” → turn off HOME binding as previously suggested?) and then with the directory not being found (“no such file or directory”) when I am in jovyan/work.

Has anyone been successful recently at running Mindboggle with Singularity?

Might be something small that doesn’t allow me to run the command, I’m quite new to programming after all. But I figured it’d be worth asking on here, since I’ve been trying to run it for a while!

Thanks in advance and best,
Lena

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

#SBATCH --job-name=mindbogglesub10
#SBATCH --time=24:00:00
#SBATCH --partition=batch
#SBATCH --output=/project/3017084.01/Analysis/Lena/Mindboggle/logs/%x_%j.out
#SBATCH --error=/project/3017084.01/Analysis/Lena/Mindboggle/logs/%x_%j.err

#Variables
HOST=/project/3017084.01/raw/BIDS
PWD=/project/3017084.01/Analysis/Lena/Mindboggle
DOCK=/home/jovyan/work
IMAGE=/project/3017084.01/Analysis/Lena/Mindboggle/MindboggleTest_T1w.nii.gz
ID=test-01

module load singularity

#Run Mindboggle
singularity run \
  -B $HOST:$DOCK:ro \
  -B $PWD:$DOCK \
  -B $PWD/jovyan:/home/jovyan \
  -e \
  mindboggle_latest.sif \
  $DOCK/$IMAGE \
  --id $ID \
  --plugin MultiProc --plugin_args "dict(n_procs=2)" \
  --fs_openmp 5 --ants_num_threads 5 --mb_num_threads 10

Version:

PUT VERSION HERE

Environment (Docker, Singularity / Apptainer, custom installation):

Singularity / Apptainer

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

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

PASTE LOG OUTPUT HERE

Screenshots / relevant information:


Hi @lenkoh and welcome to neurostars!

In the future please use the Software Support post category and template to organize your post. You can see I edited your post for you this time, and there is still some information that would be helpful to know, especially the log outputs. You can edit your post to add this information.

Also, is there a reason you are mounting two different paths as DOCK in your singularity preamble? That is:

Also, $DOCK/$IMAGE is going to create a long path that combines two absolute paths, I doubt that is what you intended. I am not sure I am seeing the logic behind your bind strings here.

Why don’t you try something simpler:

OUT=/project/3017084.01/Analysis/Lena/Mindboggle #OR WHEREEVER YOU WANT OUTPUTS
singularity exec \
  -B $IMAGE:/t1.nii.gz:ro \
  -B $OUT:/out
  -e \
  mindboggle_latest.sif \
  mindboggle \
  /t1.nii.gz \
  --out /out \
  --id $ID \
  --plugin MultiProc --plugin_args "dict(n_procs=2)" \
  --fs_openmp 5 --ants_num_threads 5 --mb_num_threads 10

Best,
Steven

Hi Steven,

Thank you for your response! I have tried it, and while I’m still running into errors, I believe I’m on a good path now.

To your question regarding the DOCK variable: I did this because that’s what is suggested on the Mindboggle website: Mindboggle — Mindboggle 1.3.8 documentation. I directly took it from there.

I tried the command you suggested. I have one question: For the “t1.nii.gz” parts of the code, am I supposed to insert the name of my nii.gz image, or is this some sort of instruction to Mindboggle that it should operate with a T1 image? I tried running it with both “t1.nii.gz” and my image “MindboggleTest_T1w.nii.gz”. I’m not sure because the IMAGE variable already specifies which image mindboggle should work with.

Either way, I believe I’m still running into problems because of the mounting. With the code you suggested, I get the error:

Traceback (most recent call last):
File “/opt/miniconda-latest/envs/mb/bin/mindboggle”, line 194, in
raise IOError(“Please provide correct path to DATA.”)
OSError: Please provide correct path to DATA.

Do you know what I could do to fix this?

Thank you again for you time.

Best,
Lena

In the code I wrote, the path to your t1 ($IMAGE) is mounted in the container as t1.nii.gz

I would need to see the full script you use.

Best,
Steven

Hi Steven,

Thank you for your response! I mostly tried the code you wrote, but adapted some things. This is what the script looks like now:

#!/bin/bash

#SBATCH --job-name=mindbogglesub10
#SBATCH --time=24:00:00
#SBATCH --partition=batch
#SBATCH --output=/project/3017084.01/Analysis/Lena/Mindboggle/logs/%x_%j.out
#SBATCH --error=/project/3017084.01/Analysis/Lena/Mindboggle/logs/%x_%j.err

#Variables
HOST=/project/3017084.01/Analysis/Lena/Mindboggle
DOCK=/home/jovyan/work
IMAGE=/project/3017084.01/Analysis/Lena/Mindboggle/MindboggleTest_T1w.nii.gz
ID=test-01
OUT=/project/3017084.01/Analysis/Lena/Mindboggle

module load singularity

#Run Mindboggle
singularity run \
  -B $HOST:$DOCK:ro \
  -B $IMAGE:/t1.nii.gz:ro \
  -B $OUT:/out \
  -e \
  mindboggle_latest.sif \
  mindboggle \
  t1.nii.gz \
  --out /out \
  --plugin MultiProc --plugin_args "dict(n_procs=2)" \

And this is the error I get when I try to run it on the cluster:

Traceback (most recent call last):
File “/opt/miniconda-latest/envs/mb/bin/mindboggle”, line 194, in
raise IOError(“Please provide correct path to DATA.”)
OSError: Please provide correct path to DATA.

Best,
Lena

Hi @lenkoh,

You are missing the “/“ before t1.nii.gz in your first positional mindboggle argument.

Best,
Steven