Fmriprep templateflow issue on HPC (No Internet)

Hi all,

I’m trying to setup fmriprep on my university’s HPC that does not have internet access.

Following previous suggestions, I have downloaded templates from templateflow into a local directory. I have folders for each template stored at this path: /home/tun47039/work/templateflow

With the script below, I am intending to set this directory to be used by fmriprep, however, it appears that fmriprep is still attempting to download templates from the internet, resulting in the error that is pasted at the bottom of this post. I have confirmed that the file that is trying to be downloaded in the error is present in my templateflow directory.

Any ideas why this is not working?

Script:
TEMPLATEFLOW_DIR=/home/tun47039/work/templateflow
export SINGULARITYENV_TEMPLATEFLOW_HOME=/home/fmriprep/.cache/templateflow

singularity run --cleanenv -B ${TEMPLATEFLOW_DIR}:/home/fmriprep/.cache/templateflow
/home/tun47039/fmriprep-20.2.6.simg
/home/tun47039/work/tads_bids /home/tun47039/work/tads_bids/derivatives
-w /home/tun47039/scratch
participant --participant_label 5000
–fs-license-file /home/tun47039/work/tads_bids/license.txt
–stop-on-first-crash
–nthreads 8 --omp-nthreads 8
–use-syn-sdc
–fs-no-reconall
–skip-bids-validation
–notrack

Error:
Downloading https://templateflow.s3.amazonaws.com/tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_T1w.nii.gz
Process Process-2:
Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/connection.py”, line 171, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/util/connection.py”, line 79, in create_connection
raise err
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/util/connection.py”, line 69, in create_connection
sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 343, in _make_request
self._validate_conn(conn)
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 849, in _validate_conn
conn.connect()
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/connection.py”, line 314, in connect
conn = self._new_conn()
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/connection.py”, line 180, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x2aaad3bae908>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/site-packages/requests/adapters.py”, line 445, in send
timeout=timeout
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/local/miniconda/lib/python3.7/site-packages/urllib3/util/retry.py”, line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘templateflow.s3.amazonaws.com’, port=443): Max retries exceeded with url: /tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_T1w.nii.gz (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x2aaad3bae908>: Failed to establish a new connection: [Errno 113] No route to host’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/multiprocessing/process.py”, line 297, in _bootstrap
self.run()
File “/usr/local/miniconda/lib/python3.7/multiprocessing/process.py”, line 99, in run
self._target(*self._args, **self._kwargs)
File “/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/workflow.py”, line 82, in build_workflow
retval[“workflow”] = init_fmriprep_wf()
File “/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/workflows/base.py”, line 64, in init_fmriprep_wf
single_subject_wf = init_single_subject_wf(subject_id)
File “/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/workflows/base.py”, line 252, in init_single_subject_wf
t1w=subject_data[‘t1w’],
File “/usr/local/miniconda/lib/python3.7/site-packages/smriprep/workflows/anatomical.py”, line 321, in init_anat_preproc_wf
normalization_quality=‘precise’ if not debug else ‘testing’)
File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/anat/ants.py”, line 180, in init_brain_extraction_wf
in_template, template_spec=template_spec
File “/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/utils/misc.py”, line 58, in get_template_specs
tpl_target_path = get_template(in_template, **template_spec)
File “/usr/local/miniconda/lib/python3.7/site-packages/templateflow/api.py”, line 78, in get
_s3_get(filepath)
File “/usr/local/miniconda/lib/python3.7/site-packages/templateflow/api.py”, line 220, in _s3_get
r = requests.get(url, stream=True)
File “/usr/local/miniconda/lib/python3.7/site-packages/requests/api.py”, line 72, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/local/miniconda/lib/python3.7/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/miniconda/lib/python3.7/site-packages/requests/sessions.py”, line 512, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/miniconda/lib/python3.7/site-packages/requests/sessions.py”, line 622, in send
r = adapter.send(request, **kwargs)
File “/usr/local/miniconda/lib/python3.7/site-packages/requests/adapters.py”, line 513, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘templateflow.s3.amazonaws.com’, port=443): Max retries exceeded with url: /tpl-OASIS30ANTs/tpl-OASIS30ANTs_res-01_T1w.nii.gz (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x2aaad3bae908>: Failed to establish a new connection: [Errno 113] No route to host’))