Skip to content

ValueError when running NiftyReg node #2616

Closed
@fepegar

Description

@fepegar

Summary

I get this error when running a NiftyReg registration or resampling: ValueError: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr.

Actual behavior

C:\Users\fernando\tmp
(vesseg) λ python r.py
180612-16:47:31,795 interface WARNING:
         version_from_command member of CommandLine was Deprecated in nipype-1.0.0 and deleted in 1.1.0
180612-16:47:31,866 interface WARNING:
         version_from_command member of CommandLine was Deprecated in nipype-1.0.0 and deleted in 1.1.0
Traceback (most recent call last):
  File "r.py", line 11, in <module>
    aladin.run()
  File "C:\Users\fernando\Miniconda3\envs\vesseg\lib\site-packages\nipype\interfaces\base\core.py", line 521, in run
    runtime = self._run_interface(runtime)
  File "C:\Users\fernando\Miniconda3\envs\vesseg\lib\site-packages\nipype\interfaces\base\core.py", line 1041, in _run_interface
    runtime = run_command(runtime, output=self.terminal_output)
  File "C:\Users\fernando\Miniconda3\envs\vesseg\lib\site-packages\nipype\interfaces\base\core.py", line 778, in run_command
    close_fds=True,
  File "C:\Users\fernando\Miniconda3\envs\vesseg\lib\subprocess.py", line 624, in __init__
    "close_fds is not supported on Windows platforms"
ValueError: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr

How to replicate the behavior

Run:

import pathlib
from nipype.interfaces import niftyreg

data_dir = pathlib.Path('~/tmp/oeslle').expanduser()
ref_path = flo_path = str(data_dir / 't1.nii.gz')

aladin = niftyreg.RegAladin()
aladin.inputs.ref_file = ref_path
aladin.inputs.flo_file = flo_path
aladin.inputs.lp_val = 1
aladin.run()

This

subprocess.call(aladin.cmdline.split())

works on that little script, but in a larger script Windows shows an error and the script stops working. I haven't been able to reproduce that, though.

Platform details:

In [1]: import nipype

In [2]: nipype.get_info()
Out[2]:
{'pkg_path': 'C:\\Users\\fernando\\Miniconda3\\envs\\vesseg\\lib\\site-packages\\nipype',
 'commit_source': 'archive substitution',
 'commit_hash': '%h',
 'nipype_version': '1.0.4',
 'sys_version': '3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]',
 'sys_executable': 'C:\\Users\\fernando\\Miniconda3\\envs\\vesseg\\python.exe',
 'sys_platform': 'win32',
 'numpy_version': '1.14.3',
 'scipy_version': '1.1.0',
 'networkx_version': '2.1',
 'nibabel_version': '2.2.1',
 'traits_version': '4.6.0'}

In [3]: nipype.__version__
Out[3]: '1.0.4'

Execution environment

I'm not sure what this means. I'm running Python from a conda environment.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions