templateflow / python-client

A python client to query TemplateFlow via pyBIDS
https://templateflow.org/python-client/
Apache License 2.0
8 stars 12 forks source link

"[...] is not a gzip file" #108

Closed arokem closed 8 months ago

arokem commented 1 year ago

A pyAFQ user reported that they are seeing the following error:

"nibabel.filebasedimages.ImageFileError: File C:\Users\Leqing Zhou.cache\templateflow\tpl-MNI152NLin2009cAsym\tpl-MNI152NLin2009cAsym_res-01_T1w.nii.gz is not a gzip file"

What should they do to recover from this state of affairs?

arokem commented 1 year ago

cc @RosieZho, @66RuixiZheng

mgxd commented 1 year ago

Seems like the file is corrupt - I'd try clearing the local templateflow directory ($HOME/.cache/templateflow) and redownload the data. You can use the following command, assuming you have templateflow installed in your current python environment.

python -c "import templateflow.api as tf; tf.get('MNI152NLin2009cAsym', resolution=1, desc=None, suffix='T1w')"
ZhengRuixi commented 1 year ago

I tried invoking the command and it still doesn't work, but the following warning appears, ‘repository not found at <C:\Users\Administrator.cache\templateflow>. Populating a new TemplateFlow stub. If the path reported above is not the desired location for TemplateFlow, please set the TEMPLATEFLOW_HOME environment variable.’

mgxd commented 1 year ago

Ah, I see you're on windows - you might want to check:

%userprofile%\.cache\templateflow

This should be the default location, but you can alter this by setting the TEMPLATEFLOW_HOME environment variable to a custom path.

effigies commented 1 year ago

Is this still open? @rosiezho @66RuixiZheng @arokem

oesteban commented 8 months ago

@RosieZho switched to a matlab version of AFQ so I assume templateflow is not used there.

@ZhengRuixi, did you resolve the issue?

Deleting the templateflow cache would be a first step to solve this.

oesteban commented 8 months ago

@mgxd given the prevalence of this kind of issues when pulling from S3, we should probably check MD5 sums or try to open the file with nibabel after a download, don't you think?

oesteban commented 8 months ago

I believe this is a duplicate of #53. Since my comment is sort of suggested there, let's move the conversation.