Skip to content
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

TypeError: environment can only contain strings #2509

ggsf13 opened this issue Mar 24, 2018 · 2 comments


Copy link

commented Mar 24, 2018


I'm working on an image processing task with nipype, and I got the following problem

Actual behavior

Expected behavior

How to replicate the behavior

Script/Workflow details

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\study\project\3D cnn\3DUnetCNN-master\brats\", line 155, in convert_brats_data
  File "D:\study\project\3D cnn\3DUnetCNN-master\brats\", line 124, in convert_brats_folder
    normalize_image(image_file, out_file, bias_correction=perform_bias_correction)
  File "D:\study\project\3D cnn\3DUnetCNN-master\brats\", line 112, in normalize_image
    correct_bias(in_file, out_file)
  File "D:\study\project\3D cnn\3DUnetCNN-master\brats\", line 70, in correct_bias
    done =
  File "D:\softwares\Annoconda3\lib\site-packages\nipype\interfaces\base\", line 498, in run
  File "D:\softwares\Annoconda3\lib\site-packages\nipype\interfaces\ants\", line 125, in version
    return Info.version()
  File "D:\softwares\Annoconda3\lib\site-packages\nipype\interfaces\base\", line 1283, in version
  File "D:\softwares\Annoconda3\lib\site-packages\nipype\interfaces\base\", line 516, in run
    runtime = self._run_interface(runtime)
  File "D:\softwares\Annoconda3\lib\site-packages\nipype\interfaces\base\", line 1020, in _run_interface
    runtime = run_command(runtime, output=self.terminal_output)
  File "D:\softwares\Annoconda3\lib\site-packages\nipype\interfaces\base\", line 750, in run_command
  File "D:\softwares\Annoconda3\lib\", line 709, in __init__
    restore_signals, start_new_session)
  File "D:\softwares\Annoconda3\lib\", line 997, in _execute_child
TypeError: environment can only contain strings

here are the codes that produced the error:

        def _execute_child(self, args, executable, preexec_fn, close_fds,
                           pass_fds, cwd, env,
                           startupinfo, creationflags, shell,
                           p2cread, p2cwrite,
                           c2pread, c2pwrite,
                           errread, errwrite,
                           unused_restore_signals, unused_start_new_session):
            """Execute program (MS Windows version)"""

            assert not pass_fds, "pass_fds not supported on Windows."

            if not isinstance(args, str):
                args = list2cmdline(args)

            # Process startup details
            if startupinfo is None:
                startupinfo = STARTUPINFO()
            if -1 not in (p2cread, c2pwrite, errwrite):
                startupinfo.dwFlags |= _winapi.STARTF_USESTDHANDLES
                startupinfo.hStdInput = p2cread
                startupinfo.hStdOutput = c2pwrite
                startupinfo.hStdError = errwrite

            if shell:
                startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW
                startupinfo.wShowWindow = _winapi.SW_HIDE
                comspec = os.environ.get("COMSPEC", "cmd.exe")
                args = '{} /c "{}"'.format (comspec, args)

            # Start the process
                hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                                         # no special security
                                         None, None,
                                         int(not close_fds),
                                         os.fspath(cwd) if cwd is not None else None,

Platform details:

{'pkg_path': 'D:\\softwares\\Annoconda3\\lib\\site-packages\\nipype',
 'commit_source': 'installation',
 'commit_hash': 'bded0d02',
 'nipype_version': '1.0.1',
 'sys_version': '3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]',
 'sys_executable': 'D:\\softwares\\Annoconda3\\python.exe',
 'sys_platform': 'win32',
 'numpy_version': '1.13.3',
 'scipy_version': '0.19.1',
 'networkx_version': '2.0',
 'nibabel_version': '2.2.1',
 'traits_version': '4.6.0'}

Execution environment

can anyone help me with this? any suggestion is appreciated.


This comment has been minimized.

Copy link

commented Mar 26, 2018

So it looks like this may be an incompatibility of 3DUnetCNN with more recent versions of nipype. Do they provide docker images that pre-package known compatible versions? If not, this may be worth tracking down on their side, and then seeing if there's something we can do here to resolve the issue.

@mgxd mgxd added dependency and removed dependency labels Mar 28, 2018


This comment has been minimized.

Copy link

commented Jul 24, 2018

I have exactly the same issue! Can anyone help with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.