nipy / nipype

Workflows and interfaces for neuroimaging packages
https://nipype.readthedocs.org/en/latest/
Other
745 stars 529 forks source link

No command "fslstats" or "fslmaths" on host #3348

Open teku45 opened 3 years ago

teku45 commented 3 years ago

Summary

New to nipype and running the following script

Actual behavior

This is the error I get when I run

/home/shree/.local/lib/python3.6/site-packages/niflow/nipype1/workflows/dmri/mrtrix/group_connectivity.py:16: UserWarning: cmp not installed
  warnings.warn('cmp not installed')
/home/shree/.local/lib/python3.6/site-packages/nipype/workflows/__init__.py:28: UserWarning: Nipype 1 workflows have been moved to the niflow-nipype1-workflows package. nipype.workflows.* provides a reference for backwards compatibility. Please use niflow.nipype1.workflows.* to avoid this warning.
  warnings.warn(" ".join(_msg))
210622-21:41:33,309 nipype.interface WARNING:
     FSLOUTPUTTYPE environment variable is not set. Setting FSLOUTPUTTYPE=NIFTI
210622-21:41:33,311 nipype.interface WARNING:
     FSLOUTPUTTYPE environment variable is not set. Setting FSLOUTPUTTYPE=NIFTI
210622-21:41:33,312 nipype.interface WARNING:
     FSLOUTPUTTYPE environment variable is not set. Setting FSLOUTPUTTYPE=NIFTI
210622-21:41:33,313 nipype.interface WARNING:
     FSLOUTPUTTYPE environment variable is not set. Setting FSLOUTPUTTYPE=NIFTI
210622-21:41:33,538 nipype.workflow INFO:
     Workflow susan_smooth settings: ['check', 'execution', 'logging', 'monitoring']
210622-21:41:33,543 nipype.workflow INFO:
     Running serially.
210622-21:41:33,543 nipype.workflow INFO:
     [Node] Setting-up "susan_smooth.mask" in "/home/shree/susan_smooth/mask".
210622-21:41:33,550 nipype.workflow INFO:
     [Node] Setting-up "_mask0" in "/home/shree/susan_smooth/mask/mapflow/_mask0".
210622-21:41:33,554 nipype.workflow INFO:
     [Node] Running "_mask0" ("nipype.interfaces.fsl.utils.ImageMaths"), a CommandLine Interface with command:
fslmaths /media/danella/DATA3/Shree_work/fmriprep/sub-105/ses-pre/func/sub-105_ses-pre_task-cogert1_run-001_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz -mas /media/danella/DATA3/Shree_work/fmriprep/sub-105/ses-pre/func/sub-105_ses-pre_task-cogert1_run-001_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz /home/shree/susan_smooth/mask/mapflow/_mask0/sub-105_ses-pre_task-cogert1_run-001_space-MNI152NLin2009cAsym_desc-preproc_bold_mask.nii
210622-21:41:33,556 nipype.workflow WARNING:
     Storing result file without outputs
210622-21:41:33,556 nipype.workflow WARNING:
     [Node] Error on "_mask0" (/home/shree/susan_smooth/mask/mapflow/_mask0)
210622-21:41:33,558 nipype.workflow WARNING:
     Storing result file without outputs
210622-21:41:33,558 nipype.workflow WARNING:
     [Node] Error on "susan_smooth.mask" (/home/shree/susan_smooth/mask)
210622-21:41:33,559 nipype.workflow ERROR:
     Node mask failed to run on host oac3loeffdanH.
210622-21:41:33,559 nipype.workflow ERROR:
     Saving crash info to /home/shree/crash-20210622-214133-shree-mask-fddc3e11-b82a-4fe7-ac62-1564925a4fca.pklz
Traceback (most recent call last):
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 45, in run
    node.run(updatehash=updatehash)
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
    result = self._run_interface(execute=True)
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 1385, in _run_interface
    self.config["execution"]["stop_on_first_crash"]
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 1294, in _collate_results
    "Subnodes of node: %s failed:\n%s" % (self.name, "\n".join(msg))
Exception: Subnodes of node: mask failed:
Subnode 0 failed
Error: Traceback (most recent call last):

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 94, in nodelist_runner
    result = node.run(updatehash=updatehash)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
    result = self._run_interface(execute=True)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
    return self._run_command(execute)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command
    result = self._interface.run(cwd=outdir)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 428, in run
    runtime = self._run_interface(runtime)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 811, in _run_interface
    % (executable_name, runtime.hostname)

OSError: No command "fslmaths" found on host oac3loeffdanH. Please check that the corresponding package is installed.

210622-21:41:33,561 nipype.workflow INFO:
     [Node] Setting-up "susan_smooth.median" in "/home/shree/susan_smooth/median".
210622-21:41:33,569 nipype.workflow INFO:
     [Node] Setting-up "_median0" in "/home/shree/susan_smooth/median/mapflow/_median0".
210622-21:41:33,573 nipype.workflow INFO:
     [Node] Running "_median0" ("nipype.interfaces.fsl.utils.ImageStats"), a CommandLine Interface with command:
fslstats /media/danella/DATA3/Shree_work/fmriprep/sub-105/ses-pre/func/sub-105_ses-pre_task-cogert1_run-001_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz -k /media/danella/DATA3/Shree_work/fmriprep/sub-105/ses-pre/func/sub-105_ses-pre_task-cogert1_run-001_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz -p 50 
210622-21:41:33,574 nipype.workflow WARNING:
     Storing result file without outputs
210622-21:41:33,574 nipype.workflow WARNING:
     [Node] Error on "_median0" (/home/shree/susan_smooth/median/mapflow/_median0)
210622-21:41:33,576 nipype.workflow WARNING:
     Storing result file without outputs
210622-21:41:33,576 nipype.workflow WARNING:
     [Node] Error on "susan_smooth.median" (/home/shree/susan_smooth/median)
210622-21:41:33,577 nipype.workflow ERROR:
     Node median failed to run on host oac3loeffdanH.
210622-21:41:33,577 nipype.workflow ERROR:
     Saving crash info to /home/shree/crash-20210622-214133-shree-median-fa025016-76f0-4a8a-af52-2abd297de45b.pklz
Traceback (most recent call last):
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 45, in run
    node.run(updatehash=updatehash)
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
    result = self._run_interface(execute=True)
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 1385, in _run_interface
    self.config["execution"]["stop_on_first_crash"]
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 1294, in _collate_results
    "Subnodes of node: %s failed:\n%s" % (self.name, "\n".join(msg))
Exception: Subnodes of node: median failed:
Subnode 0 failed
Error: Traceback (most recent call last):

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 94, in nodelist_runner
    result = node.run(updatehash=updatehash)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run
    result = self._run_interface(execute=True)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface
    return self._run_command(execute)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command
    result = self._interface.run(cwd=outdir)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 428, in run
    runtime = self._run_interface(runtime)

  File "/home/shree/.local/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 811, in _run_interface
    % (executable_name, runtime.hostname)

OSError: No command "fslstats" found on host oac3loeffdanH. Please check that the corresponding package is installed.

210622-21:41:33,578 nipype.workflow INFO:
     ***********************************
210622-21:41:33,578 nipype.workflow ERROR:
     could not run node: susan_smooth.mask
210622-21:41:33,578 nipype.workflow INFO:
     crashfile: /home/shree/crash-20210622-214133-shree-mask-fddc3e11-b82a-4fe7-ac62-1564925a4fca.pklz
210622-21:41:33,578 nipype.workflow ERROR:
     could not run node: susan_smooth.median
210622-21:41:33,578 nipype.workflow INFO:
     crashfile: /home/shree/crash-20210622-214133-shree-median-fa025016-76f0-4a8a-af52-2abd297de45b.pklz
210622-21:41:33,578 nipype.workflow INFO:
     ***********************************
Traceback (most recent call last):
  File "test_smooth_script.py", line 20, in <module>
    susan.run()
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/engine/workflows.py", line 638, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 69, in run
    report_nodes_not_run(notrun)
  File "/home/shree/.local/lib/python3.6/site-packages/nipype/pipeline/plugins/tools.py", line 97, in report_nodes_not_run
    ("Workflow did not execute cleanly. " "Check log for details")
RuntimeError: Workflow did not execute cleanly. Check log for details

Script/Workflow detail

Script I am trying to run

from nipype.workflows.fmri.fsl.preprocess import create_susan_smooth
fwhm=6
preproc_path="/media/danella/DATA3/Shree_work/fmriprep"
work_dir="/home/shree"
output_dir="/media/danella/DATA3/Shree_work/FirstLevel_Analysis/smoothed_files/"
ID_list=["105"]
session_list=["pre","post"]
for ID in ID_list:
    for session in session_list:

        in_file="%s/sub-%s/ses-%s/func/sub-%s_ses-%s_task-cogert1_run-001_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz" % (preproc_path,ID,session,ID,session)
        mask_file="%s/sub-%s/ses-%s/func/sub-%s_ses-%s_task-cogert1_run-001_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz" % (preproc_path,ID,session,ID,session)
        smoothed_file="%s/susan_smooth/smooth/mapflow/_smooth0/sub-%s_ses-%s_task-cogert1_run-001_space-MNI152NLin2009cAsym_desc-preproc_bold_smooth.nii.gz" % (work_dir,ID,session)

        susan=create_susan_smooth()
        susan.base_dir=work_dir
        susan.inputs.inputnode.in_files=in_file
        susan.inputs.inputnode.fwhm=fwhm
        susan.inputs.inputnode.mask_file=mask_file
        susan.run()
        shutil.copy(smoothed_file,output_dir)

Platform details:

Ubuntu 18.04 LTS Python 3.6 Nipype 1.6.1

Execution environment

Not running in any container

effigies commented 3 years ago

You need to have FSL installed on the host. If you can run it in bash, then you should be able to run it with nipype. Depending on your installation, you might need to set the FSLDIR environment variable. Please see https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation.