FMRIPREP from Singularity: UnboundLocalError

I can’t replicate with singularity 2.6.1-2~nd18.04+1

I also get the same issue of ‘Exception: No BOLD images found’ for the singularity image on Dropbox.

Hi @PhilK

Can you check with other subjects (--participant-label)?

Thanks!

It seems that in our HPC they have recently updated Singularity and since then some folders that used to be bound are not anymore. Could this be the case?

Maybe, but when I do

> singularity shell fmriprep-1.2.6.simg
>> python
>>> from bids import BIDSLayout
>>> layout = BIDSLayout('/home/gillesd/sourcedata_fmriprep')
>>> layout.get(subject='01', type='bold')

I do get what I expect:

[File(filename='/home/gillesd/fmriprep_data/sub-01/func/sub-01_task-randomdotmotion_run-01_bold.nii', subject='01', task='randomdotmotion', run=1, type='bold', modality='func'), 
File(filename='/home/gillesd/fmriprep_data/sub-01/func/sub-01_task-randomdotmotion_run-02_bold.nii', subject='01', task='randomdotmotion', run=2, type='bold', modality='func'), 
File(filename='/home/gillesd/fmriprep_data/sub-01/func/sub-01_task-randomdotmotion_run-03_bold.nii', subject='01', task='randomdotmotion', run=3, type='bold', modality='func')]
1 Like

I’m sorry for having to disappoint you again, but the problem occurs with other subjects as well (I tested a random sample of ~10 other subjects).

Hey @effigies any thoughts on this one? I might be missing out something.

Possibly let’s make sure we’re importing the correct things. I don’t see how they can possibly be hitting this ses_uids thing in the latest release:

singularity shell fmriprep-1.2.6-1.simg
> python
>>> import bids, niworkflows, fmriprep
>>> print(fmriprep.__version__)
>>> print(niworkflows.__version__)
>>> print(bids.__version__)

Some additional commands that may help diagnose this:

> singularity shell fmriprep-1.2.6.simg
>> python
>>> from bids import BIDSLayout
>>> layout = BIDSLayout('/home/gillesd/sourcedata_fmriprep')
>>> layout.get(subject='01', type='bold', modality='func', extensions=['nii', 'nii.gz'])

and

> singularity shell fmriprep-1.2.6.simg
>> python
>>> from niworkflows.utils.bids import collect_data
>>> collect_data('/home/gillesd/sourcedata_fmriprep', '01')

Possibly let’s make sure we’re importing the correct things. I don’t see how they can possibly be hitting this ses_uids thing in the latest release:

>>> import bids, niworkflows, fmriprep
>>> print(fmriprep.__version__)>>> print(fmriprep.__version__)
1.2.6-1
>>> print(niworkflows.__version__)
0.5.2.post7
>>> print(bids.__version__)
0.6.5
>>>

OK

> singularity shell fmriprep-latest.simg # (This is 1.2.6-1)
>>> from bids import BIDSLayout
>>> layout = BIDSLayout('/home/gholland/data/bias_task/fmriprep_sourcedata')
>>> layout.get(subject='01', type='bold', modality='func', extensions=['nii', 'nii.gz'])
[File(filename='/home/gholland/data/bias_task/fmriprep_sourcedata/sub-01/func/sub-01_task-randomdotmotion_run-01_bold.nii', subject='01', task='randomdotmotion', run=1, type='bold', modality='func'), File(filename='/home/gholland/data/bias_task/fmriprep_sourcedata/sub-01/func/sub-01_task-randomdotmotion_run-02_bold.nii', subject='01', task='randomdotmotion', run=2, type='bold', modality='func'), File(filename='/home/gholland/data/bias_task/fmriprep_sourcedata/sub-01/func/sub-01_task-randomdotmotion_run-03_bold.nii', subject='01', task='randomdotmotion', run=3, type='bold', modality='func')]

But:

>>> from niworkflows.utils.bids import collect_data
>>> collect_data('/home/gholland/data/bias_task/fmriprep_sourcedata')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/utils/bids.py", line 181, in collect_data
    subj_data.update({"bold": ses_uids})
UnboundLocalError: local variable 'ses_uids' referenced before assignment

Further update: a colleague of mine gets the “no T1w images found”-error with fmriprep 1.1.8, even though this exact image, code, and data used to run fine on this cluster (note that this dataset only contains anatomical data). I will drop an email to the people that take care of the cluster as well.

@Gilles_de_Hollander and @PhilK, can I trouble you to try out the recently release fMRIPrep 1.3.0? We didn’t add any specific fixes for this issue, but I cannot understand how you were getting those errors on 1.2.6-1, unless there somehow was a container-related issue where remnants of 1.2.6 were still around to cause trouble. It’s my hope that a brand new version will have cleared out the debris.

16 posts were split to a new topic: fMRIPrep 1.3.x on Singularity - git-annex permission errors

Is the UnboundLocalError resolved as well?

Yes. Fmriprep now starts to run properly on my data…

4 Likes

This has been a puzzling one. Thank you all for your patience and collaborative spirit!

@PhilK, @Benjamin_Zimmerman can you confirm the good news on your end?

1 Like

Yes! Good news confirmed. Fmriprep:tfpatch is working for me.Thanks for your work!

2 Likes

@effigies @oesteban It’s now running successfully for me as well with tfpatch! :slight_smile: Thanks a lot for your fantastic work!

2 Likes

16 posts were merged into an existing topic: Datalad Error in 1.3.0.post2, libc/kernel mismatch

3 posts were split to a new topic: fMRIPrep: Could not generate CITATION.html file