Fmriprep node hash + trait errors

Hi NeuroStars,

We’ve been successfully running fmriprep-1.1.8.simg on our cluster on some multiband and multiecho pilot data without errors, but have suddenly run into the errors below on a multiecho pilot subject (this is a different subject than the one I posted about earlier, just in case emdupre sees this :slight_smile: ). The dataset passed BIDS validation and I saw an earlier thread on trait errors that were fixed in earlier releases… Any thoughts/suggestions?

Thank you!

fmriprep output

References

[WARNING] This document format requires a nonempty element.
Please specify either ‘title’ or ‘pagetitle’ in the metadata.
Falling back to ‘CITATION’
/usr/local/miniconda/lib/python3.6/site-packages/bids/grabbids/init.py:6: FutureWarning: grabbids has been renamed to layout in version 0.6.5, and will be removed in version 0.8
warnings.warn(“grabbids has been renamed to layout in version 0.6.5, and will be removed in version 0.8”, FutureWarning)
181022-09:41:04,107 nipype.workflow WARNING:
Error while checking node hash, forcing re-run. Although this error may not prevent the workflow from running, it could indicate a major problem. Please report a new issue at https://github.com/nipy/nipype/issues adding the following information:

    Node: fmriprep_wf.single_subject_08ME_wf.summary
    Interface: fmriprep.interfaces.reports.SubjectSummary
    Traceback:

Traceback (most recent call last):

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/base.py”, line 338, in _local_hash_check
cached, updated = self.procs[jobid].is_cached()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 294, in is_cached
hashed_inputs, hashvalue = self._get_hashval()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 488, in _get_hashval
self._get_inputs()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 515, in _get_inputs
results = loadpkl(results_file)

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 668, in loadpkl
raise e

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 659, in loadpkl
unpkl = pickle.load(pkl_file)

File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1440, in setstate
self.trait_set( trait_change_notify = trait_change_notify, **state )

File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1543, in trait_set
setattr( self, name, value )

File “/usr/local/miniconda/lib/python3.6/site-packages/traits/trait_types.py”, line 1586, in validate
self.error( object, name, value )

File “/usr/local/miniconda/lib/python3.6/site-packages/traits/trait_handlers.py”, line 172, in error
value )

traits.trait_errors.TraitError: The ‘subjects_dir’ trait of a BIDSFreeSurferDirOutputSpec instance must be a directory name, but a value of ‘/beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer’ <class ‘str’> was specified.

Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py”, line 308, in _send_procs_to_workers
self.procs[jobid].run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 408, in run
cached, updated = self.is_cached()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 294, in is_cached
hashed_inputs, hashvalue = self._get_hashval()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 488, in _get_hashval
self._get_inputs()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 515, in _get_inputs
results = loadpkl(results_file)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 668, in loadpkl
raise e
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 659, in loadpkl
unpkl = pickle.load(pkl_file)
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1440, in setstate
self.trait_set( trait_change_notify = trait_change_notify, **state )
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1543, in trait_set
setattr( self, name, value )
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/trait_types.py”, line 1586, in validate
self.error( object, name, value )
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/trait_handlers.py”, line 172, in error
value )
traits.trait_errors.TraitError: The ‘subjects_dir’ trait of a BIDSFreeSurferDirOutputSpec instance must be a directory name, but a value of ‘/beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer’ <class ‘str’> was specified.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/miniconda/bin/fmriprep”, line 11, in
sys.exit(main())
File “/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py”, line 343, in main
fmriprep_wf.run(**plugin_settings)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/workflows.py”, line 595, in run
runner.run(execgraph, updatehash=updatehash, config=self.config)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/base.py”, line 184, in run
self._send_procs_to_workers(updatehash=updatehash, graph=graph)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py”, line 316, in _send_procs_to_workers
‘traceback’: traceback
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/base.py”, line 224, in _clean_queue
raise RuntimeError("".join(result[‘traceback’]))
RuntimeError: Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py”, line 308, in _send_procs_to_workers
self.procs[jobid].run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 408, in run
cached, updated = self.is_cached()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 294, in is_cached
hashed_inputs, hashvalue = self._get_hashval()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 488, in _get_hashval
self._get_inputs()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 515, in _get_inputs
results = loadpkl(results_file)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 668, in loadpkl
raise e
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 659, in loadpkl
unpkl = pickle.load(pkl_file)
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1440, in setstate
self.trait_set( trait_change_notify = trait_change_notify, **state )
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1543, in trait_set
setattr( self, name, value )
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/trait_types.py”, line 1586, in validate
self.error( object, name, value )
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/trait_handlers.py”, line 172, in error
value )
traits.trait_errors.TraitError: The ‘subjects_dir’ trait of a BIDSFreeSurferDirOutputSpec instance must be a directory name, but a value of ‘/beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer’ <class ‘str’> was specified.

Sentry is attempting to send 1 pending error messages
Waiting up to 10 seconds
Press Ctrl-C to quit

fmriprep call
singularity exec --cleanenv
–bind /beegfs/work/hartley/projects/seqTest/scripts/pyReports/reports.py:/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/viz/reports.py
/beegfs/work/public/singularity/fmriprep-1.1.8.simg fmriprep ${BIDS_Dir} ${Out_Dir} participant
–fs-license-file /beegfs/work/hartley/projects/seqTest/scripts/fsLicense/license.txt
–template-resampling-grid “native”
–participant_label ${SUBJ_ID}
–t2s-coreg

& because I read online this may be related to memory issues, we’ve been requesting 8 cpus per task and 50 GB of memory

This error text doesn’t make it very clear, but what it means is that /beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer either cannot be found or is not a directory.

Assuming the path exists and is a directory, then the fMRIPrep instance could not see it when it tried to look for it. This could happen for various reasons, including filesystem errors (e.g., the directory was created in one environment and was looked for in another, before the change propagated) and permissions issues (e.g. if the user fMRIPrep was run as could not run ls /beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer). This latter also includes quirks of Singularity configurations, in which some directories are not accessible from within a Singularity container.

You should be able to check this with:

$> singularity shell /beegfs/work/public/singularity/fmriprep-1.1.8.simg
$> ls /beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer

If that works, I would try re-running. If it was a synchronization issue, it may have resolved itself.

thanks for the speedy reply @effigies ! The directory did not exist, so I created it within the singularity and shell and now it throws out more errors (below). It seems that for some reason the subdirectories and/or the freesurfer outputs aren’t being made… would this be a synchronization issue? And if so, are there any resources anyone may be able to point us to on how to troubleshoot? It’s especially strange that this container seemed to work on Friday, but stopped working over the weekend… :thinking:

References

[WARNING] This document format requires a nonempty element.
Please specify either ‘title’ or ‘pagetitle’ in the metadata.
Falling back to ‘CITATION’
/usr/local/miniconda/lib/python3.6/site-packages/bids/grabbids/init.py:6: FutureWarning: grabbids has been renamed to layout in version 0.6.5, and will be removed in version 0.8
warnings.warn(“grabbids has been renamed to layout in version 0.6.5, and will be removed in version 0.8”, FutureWarning)
181022-11:39:37,708 nipype.workflow WARNING:
Error while checking node hash, forcing re-run. Although this error may not prevent the workflow from running, it could indicate a major problem. Please report a new issue at https://github.com/nipy/nipype/issues adding the following information:

    Node: fmriprep_wf.single_subject_08ME_wf.anat_preproc_wf.surface_recon_wf.fsnative_2_t1_xfm
    Interface: fmriprep.interfaces.freesurfer.PatchedRobustRegister
    Traceback:

Traceback (most recent call last):

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/base.py”, line 338, in _local_hash_check
cached, updated = self.procs[jobid].is_cached()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 294, in is_cached
hashed_inputs, hashvalue = self._get_hashval()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 488, in _get_hashval
self._get_inputs()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 515, in _get_inputs
results = loadpkl(results_file)

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 668, in loadpkl
raise e

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 659, in loadpkl
unpkl = pickle.load(pkl_file)

File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1440, in setstate
self.trait_set( trait_change_notify = trait_change_notify, **state )

File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1543, in trait_set
setattr( self, name, value )

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/interfaces/base/traits_extension.py”, line 112, in validate
self.info_text, value))

traits.trait_errors.TraitError: The trait ‘T1’ of a ReconAllOutputSpec instance is an existing file name, but the path ‘/beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer/sub-08ME/mri/T1.mgz’ does not exist.

181022-11:39:37,823 nipype.workflow WARNING:
Error while checking node hash, forcing re-run. Although this error may not prevent the workflow from running, it could indicate a major problem. Please report a new issue at https://github.com/nipy/nipype/issues adding the following information:

    Node: fmriprep_wf.single_subject_08ME_wf.anat_preproc_wf.surface_recon_wf.skull_strip_extern
    Interface: fmriprep.interfaces.freesurfer.FSInjectBrainExtracted
    Traceback:

Traceback (most recent call last):

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/base.py”, line 338, in _local_hash_check
cached, updated = self.procs[jobid].is_cached()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 294, in is_cached
hashed_inputs, hashvalue = self._get_hashval()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 488, in _get_hashval
self._get_inputs()

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 515, in _get_inputs
results = loadpkl(results_file)

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 668, in loadpkl
raise e

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 659, in loadpkl
unpkl = pickle.load(pkl_file)

File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1440, in setstate
self.trait_set( trait_change_notify = trait_change_notify, **state )

File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1543, in trait_set
setattr( self, name, value )

File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/interfaces/base/traits_extension.py”, line 112, in validate
self.info_text, value))

traits.trait_errors.TraitError: The trait ‘T1’ of a ReconAllOutputSpec instance is an existing file name, but the path ‘/beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer/sub-08ME/mri/T1.mgz’ does not exist.

181022-11:39:39,861 nipype.workflow INFO:
[Node] Setting-up “fmriprep_wf.single_subject_08ME_wf.anat_preproc_wf.surface_recon_wf.fsnative_2_t1_xfm” in “/beegfs/work/hartley/projects/seqTest/work/fmriprep_wf/single_subject_08ME_wf/anat_preproc_wf/surface_recon_wf/fsnative_2_t1_xfm”.
181022-11:39:39,960 nipype.workflow INFO:
[Node] Setting-up “fmriprep_wf.single_subject_08ME_wf.anat_preproc_wf.surface_recon_wf.skull_strip_extern” in “/beegfs/work/hartley/projects/seqTest/work/fmriprep_wf/single_subject_08ME_wf/anat_preproc_wf/surface_recon_wf/skull_strip_extern”.
Traceback (most recent call last):
File “/usr/local/miniconda/bin/fmriprep”, line 11, in
sys.exit(main())
File “/usr/local/miniconda/lib/python3.6/site-packages/fmriprep/cli/run.py”, line 343, in main
fmriprep_wf.run(**plugin_settings)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/workflows.py”, line 595, in run
runner.run(execgraph, updatehash=updatehash, config=self.config)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/base.py”, line 162, in run
self._clean_queue(jobid, graph, result=result))
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/base.py”, line 224, in _clean_queue
raise RuntimeError("".join(result[‘traceback’]))
RuntimeError: Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py”, line 69, in run_node
result[‘result’] = node.run(updatehash=updatehash)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 408, in run
cached, updated = self.is_cached()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 294, in is_cached
hashed_inputs, hashvalue = self._get_hashval()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 488, in _get_hashval
self._get_inputs()
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py”, line 515, in _get_inputs
results = loadpkl(results_file)
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 668, in loadpkl
raise e
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/utils/filemanip.py”, line 659, in loadpkl
unpkl = pickle.load(pkl_file)
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1440, in setstate
self.trait_set( trait_change_notify = trait_change_notify, **state )
File “/usr/local/miniconda/lib/python3.6/site-packages/traits/has_traits.py”, line 1543, in trait_set
setattr( self, name, value )
File “/usr/local/miniconda/lib/python3.6/site-packages/nipype/interfaces/base/traits_extension.py”, line 112, in validate
self.info_text, value))
traits.trait_errors.TraitError: The trait ‘T1’ of a ReconAllOutputSpec instance is an existing file name, but the path ‘/beegfs/work/hartley/projects/seqTest/Out_SeqTest_ME08/freesurfer/sub-08ME/mri/T1.mgz’ does not exist.

Sentry is attempting to send 1 pending error messages
Waiting up to 10 seconds
Press Ctrl-C to quit

I don’t see any binds for ${BIDS_Dir} or ${Out_Dir} in your singularity command line. Perhaps you are trying to write to a new destination that is not auto bound and needs an explicit --bind flag?

PS I see you are patching some of the code in reports.py - if you fixed a bug please send a PR on https://github.com/poldracklab/fmriprep/pulls

@ChrisGorgolewski RE PR, already done :slightly_smiling_face:

haven’t had success adding the binds (same errors) but I’ll get in touch with the coordinator of our cluster to see if he can help troubleshoot, now that I have a better idea of why this might be happening. will report back. thanks!

^I’ve been reassured that this is not the issue because a number of directories are bound to singularity by default on our cluster

Is there any chance you’re reusing a working directory? I notice these are all failures to populate output specs, which can happen if your instance thinks it’s already run a node, the node is internally consistent, but its outputs no longer exist. It’s rare for outputs to exist outside the working directory, but the FreeSurfer components are among the few where that’s true.

If using a new working directory resolves this, I believe the solution would be for us to mark these nodes as always_run, so that they don’t assume an internally consistent node result means the output can be trusted.

1 Like

@effigies this seems to have been the problem-- writing to a brand new working directory has gotten us past these errors (:crossed_fingers: for no others)

thank you!!

1 Like