Skip to content

Templateflow + Singularity issue #2760

@effigies

Description

@effigies

Okay, /.cache/templateflow/tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_T1w.nii.gz makes me think something is not going right with your bindings - I'd recommend using absolute paths to ensure everything is pointing to the correct location.

If you want to verify, try the following minimal example in a shell - lines starting with # are comments and lines starting with $ are commands

# if you don't have the wget, you can replace `wget` below with `curl -O`
$ wget https://raw.githubusercontent.com/mgxd/fmriprep/enh/fetch-tf-templates/scripts/fetch_templates.py

$ python -m pip install --upgrade templateflow  # to ensure access to the latest templates 

$ mkdir <path-to-save-templateflow-templates>

$ python fetch_templates.py --tf-dir <path-to-save-templateflow-templates>

$ export SINGULARITYENV_TEMPLATEFLOW_HOME="/templates"

$ singularity shell --cleanenv -B <full-path-to-saved-templates>:/templates:ro <fmriprep-image>

# This is inside the container
# Should be "/templates"
$ > echo $TEMPLATEFLOW_HOME

# The file should not be empty (0B)
$ > du -h ${TEMPLATEFLOW_HOME}/tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_T1w.nii.gz

# Nothing should be downloaded since the file was already retrieved
$ > python -c "from templateflow.api import get; get('OASIS30ANTs', resolution=1, desc=None, label=None, suffix='T1w')"

Hi, I'm having exactly the same issue of binding templateflow. Everything worked correctly based on this test. I found that templateflow can be accessed without problem if with python even inside singularity shell, but will be problematic with command line only (either singularity shell / singularity run / singularity exec). I'm not that lucky as @ejcorn, changing directory name of templateflow did not help me. Just wonder if there's anything else I can do to debug this?

Originally posted by @snapfinger in #2480 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions