Skip to content

Latest version of traits (6.4.1) seems to break init_brain_extraction_wf #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ellisdg opened this issue Aug 26, 2022 · 2 comments
Closed

Comments

@ellisdg
Copy link

ellisdg commented Aug 26, 2022

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.

@effigies
Copy link
Member

Yes. Traits 6.4 is breaking all of nipype. We need to set a hard upper bound, IMO. The next release of nipype will include nipy/nipype#3501, but downstream projects probably need it too.

@mgxd
Copy link
Contributor

mgxd commented Oct 10, 2022

This has been incorporated in 1.6.3 and above

@mgxd mgxd closed this as completed Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants