Closed
Description
I am having issues using niworkflows in an environment that has the latest version of traits (traits==6.4.1) installed.
I was able to recreate the error by running the following in a brand new Anaconda environment:
conda install python=3.9 pip
pip install niworkflows==1.6.2 traits==6.4.1
python
>>> from niworkflows.anat.ants import init_brain_extraction_wf
>>> wf = init_brain_extraction_wf()
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/niworkflows/anat/ants.py", line 305, in init_brain_extraction_wf
Registration(
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/nipype/interfaces/ants/registration.py", line 1015, in __init__
super(Registration, self).__init__(**inputs)
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/nipype/interfaces/ants/base.py", line 77, in __init__
super(ANTSCommand, self).__init__(**inputs)
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 630, in __init__
super(CommandLine, self).__init__(**inputs)
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 210, in __init__
self.load_inputs_from_json(from_file, overwrite=True)
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 489, in load_inputs_from_json
setattr(self.inputs, key, inputs_dict[key])
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/traits/trait_types.py", line 2695, in validate
return TraitListObject(self, object, name, value)
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/traits/trait_list_object.py", line 584, in __init__
super().__init__(
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/traits/trait_list_object.py", line 213, in __init__
super().__init__(self.item_validator(item) for item in iterable)
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/traits/trait_list_object.py", line 213, in <genexpr>
super().__init__(self.item_validator(item) for item in iterable)
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/traits/trait_list_object.py", line 867, in _item_validator
return trait_validator(object, self.name, value)
File "/Users/david.ellis/miniconda3/envs/nipype/lib/python3.10/site-packages/traits/base_trait_handler.py", line 74, in error
raise TraitError(
traits.trait_errors.TraitError: Each element of the 'transform_parameters' trait of a _FixHeaderRegistrationInputSpec instance must be a tuple of the form: (a float) or a tuple of the form: (a float, a float, a float) or a tuple of the form: (a float, an integer, an integer, an integer) or a tuple of the form: (a float, an integer, a float, a float, a float, a float) or a tuple of the form: (a float, a float, a float, an integer) or a tuple of the form: (a float, an integer, an integer, an integer, an integer), but a value of [0.1] <class 'list'> was specified.
But when I revert back to traits==6.3.2, the error is avoided:
pip install traits==6.3.2
python
>>> from niworkflows.anat.ants import init_brain_extraction_wf
>>> wf = init_brain_extraction_wf()
Therefore, it seems that the latest version of traits causes the loading of the data json files in niworkflows to fail, at least for _FixHeaderRegistrationInputSpec.
Metadata
Metadata
Assignees
Labels
No labels