Skip to content

Issues of interfacing with PETPVC modules #2068

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
ubersexualShupeng opened this issue Jun 6, 2017 · 7 comments
Closed

Issues of interfacing with PETPVC modules #2068

ubersexualShupeng opened this issue Jun 6, 2017 · 7 comments

Comments

@ubersexualShupeng
Copy link

Hi @effigies @alexsavio, I have run it in a Node and the content of the file report.rst as following:

Node: petpvc

Hierarchy : pvc
Exec ID : pvc

Original Inputs

  • alpha :
  • args :
  • debug : False
  • environ : {}
  • fwhm_x : 2.0
  • fwhm_y : 2.0
  • fwhm_z : 2.0
  • ignore_exception : False
  • in_file : C:\Users\135173\Desktop\pvc_test\PET_nii\x_WB_CTAC_Body.nii.gz
  • mask_file : C:\Users\135173\Desktop\pvc_test\mask_nill\skin_mask.nii.gz
  • n_deconv :
  • n_iter :
  • out_file : C:\Users\135173\Desktop\pvc_test\pet_pvc_rbv.nii.gz
  • pvc : RBV
  • stop_crit :
  • terminal_output : stream

Thanks.

@effigies
Copy link
Member

effigies commented Jun 6, 2017 via email

@ubersexualShupeng
Copy link
Author

I have tried to replace the back slashes to 'double back slashes' '\' or forward dash '/' but the same error still appeared. Is there are any other possible problems?

The error messages as following:
TypeError: environment can only contain strings
Interface PETPVC failed to run.

Thanks.

@effigies
Copy link
Member

effigies commented Jun 6, 2017

I believe nipype will pass your actual environment through. Can you check

import os
print(os.environ)

for non-string keys/values? (This may contain some personal information. If you're going to post the results of this for inspection, consider censoring it.)

@mgxd
Copy link
Member

mgxd commented Jun 21, 2017

@ubersexualShupeng are you still running into this issue?

@ubersexualShupeng
Copy link
Author

Yes. I do not use this py module anymore. I use the PETPVC (binary) directly now.

@effigies
Copy link
Member

To be clear, are you able to run other external programs, such as FSL or FreeSurfer, through nipype, or is this TypeError specifically for PETPVC?


To get the context in this issue, the code run was:

import nipype
import nipype.interfaces.petpvc as PETPVC
pvc = PETPVC.PETPVC()
pvc.inputs.in_file = 'C:\Users\135173\Desktop\pvc_test\PET_nii\x_WB_CTAC_Body.nii.gz'
pvc.inputs.mask_file = 'C:\Users\135173\Desktop\pvc_test\mask_nill\skin_mask.nii.gz'
pvc.inputs.out_file = 'C:\Users\135173\Desktop\pvc_test\pet_pvc_rbv.nii.gz'
pvc.inputs.pvc = 'RBV'
pvc.inputs.fwhm_x = 2
pvc.inputs.fwhm_y = 2
pvc.inputs.fwhm_z = 2
outs = pvc.run()

With error:

 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Anaconda2\lib\site-packages\nipype\interfaces\base.py", line 1081, in run
    runtime = self._run_wrapper(runtime)
  File "C:\Program Files\Anaconda2\lib\site-packages\nipype\interfaces\base.py", line 1724, in _run_wrapper
    runtime = self._run_interface(runtime)
  File "C:\Program Files\Anaconda2\lib\site-packages\nipype\interfaces\base.py", line 1755, in _run_interface
    redirect_x=self._redirect_x)
  File "C:\Program Files\Anaconda2\lib\site-packages\nipype\interfaces\base.py", line 1457, in run_command
    env=runtime.environ)
  File "C:\Program Files\Anaconda2\lib\subprocess.py", line 390, in __init__
    errread, errwrite)
  File "C:\Program Files\Anaconda2\lib\subprocess.py", line 640, in _execute_child
    startupinfo)
TypeError: environment can only contain strings
Interface PETPVC failed to run.

This may be a Unicode-on-Windows issue (see https://stackoverflow.com/questions/12253014/why-does-popen-fail-on-windows-if-the-env-parameter-contains-a-unicode-object).

I can see if I can make a patch that filters the environment for unicode strings and replaces them with bytes.

@effigies
Copy link
Member

Hi @ubersexualShupeng. Can you give #2085 a shot?

pip install --upgrade "git+https://github.com/effigies/nipype.git@fix/windows_env#egg=nipype"

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