Failed to establish a new connection templateflow.s3.amazonaws.com

Dear fmriprep experts,

I am running fmriprep 1.4.1 with Singularity on HPC and I just tried to run it with the flag --output-spaces tpl-MNIPediatricAsym_cohort-3:res-2

However I am getting the following error

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 0x7fb10c74c908>: 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 0x7fb10c74c908>: Failed to establish a new connection: [Errno 113] No route to host'))

I have read a few previous posts and figured out that it must be a firewall issue (I think?). I am running fmriprep on our HPC and I am not sure whether I will be allowed to get the firewall rule allowed. So I was wondering if I can somehow point at the templateflow folder manually? I have downloaded it and place it in my ${home}.

Then I have tried to run

singularity run --cleanenv -B "${home}":"${home}" "${home}/fmriprep-1.4.1.simg" --fs-license-file "${home}/license.txt" "${home}/wave1_BIDS/" "${home}/output_wave1/" participant --participant-label $SUBJECT --skull-strip-template "${home}/templateflow/tpl-MNIPediatricAsym/cohort-3/tpl-MNIPediatricAsym_cohort-3:res-2" --output-spaces "${home}/templateflow/tpl-MNIPediatricAsym/cohort-3/tpl-MNIPediatricAsym_cohort-3:res-2" 

But I get an error

RuntimeError: Could not find template "/scratch/punim0025/templateflow/tpl-MNIPediatricAsym/cohort-3/tpl-MNIPediatricAsym_cohort-3" with specs={'suffix': 'T1w', 'desc': None, 'atlas': None, 'resolution': '2'}. Please revise your template argument.

Although the folder should be there and with name in conventions (I also included the template_description.json). Maybe I am doing something wrong or this function is not implemented yet? If that is the case, is there another workaround to the firewall issue?

Thank you very much!

Hi,

I managed to get the connection to template.flow.s3 and the pipeline starts, downloads the templateflow and in the log I can see that it recognises the template

The following templates were selected for spatial normalization:
MNI’s unbiased standard MRI template for pediatric data from the 4.5 to 18.5y age range [@mnipediatricasym, RRID:SCR_008796; TemplateFlow ID: MNIPediatri
cAsym]

However I still get this error (that comes with several crash files)

RuntimeError: Could not find template "MNIPediatricAsym" with specs={'3': True, 'cohort': True, 'suffix': 'T1w', 'desc': None, 'atlas': None, 'resolution': 1}. Please revise your template argument.

This is the command I am running:

singularity run --cleanenv -B "${home}":"${home}" "${home}/fmriprep-1.4.1.simg" --fs-license-file "${home}/license.txt" "${home}/wave1_BIDS/" "${home}/output_wave1/" participant --participant-label $SUBJECT --output-spaces MNIPediatricAsym:res-2:cohort:3 --fs-no-reconall

Can you please advise if I am doing something wrong?

Much appreciated!

EDIT: I have just tried to run it as --output-spaces MNIPediatricAsym:cohort:3 without specifying the resolution and it seems to be working.

I guess you meant --output-spaces MNIPediatricAsym:cohort-3 (a dash - instead of the colon :)

Hi @ElenaP, could you post how you worked around the connection problem and confirm that adding a dash fixed your problem?

I guess it did fix the issue because your error:

RuntimeError: Could not find template "MNIPediatricAsym" with specs={'3': True, 'cohort': True, 'suffix': 'T1w', 'desc': None, 'atlas': None, 'resolution': 1}. Please revise your template argument.

is clearly telling that 3 was being parse as a key from your output space specifications in the command line (MNIPediatricAsym:res-2:cohort:3). In other words MNIPediatricAsym:res-2:cohort-3 should work just fine.

Hi @oesteban, sorry for the delay. Yes, I confirm that using MNIPediatricAsym:res-2:cohort-3 fixed the RuntimeError: Could not find template.

I am trying to run it on all the subjects again now, I will report whether I run it successfully.

A post was split to a new topic: Error populating the input of a node in fMRIPrep - the results file of the source node does not exist