Skip to content

Matlab command not found by nipype despite being able to launch matlab from Terminal window #2685

@switt4

Description

@switt4

Summary

I am testing out a preprocessing pipeline largely following one of the examples posted here (https://miykael.github.io/nipype_tutorial/notebooks/example_preprocessing.html). I am running into an error when I get to the spm smoothing step:

OSError: No command "matlab" found on host ImageAnalystMacBook.local. Please check that the corresponding package is installed.

I have included the Matlab path and alias (-nodisplay -nosplash) in my .bash_profile, and a simple 'which matlab' points to the correct location. I can also launch matlab with no issues from any folder using either a Terminal or X11 window.

Following some of what was previously posted on "Matlab command cannot be found #2436":

  1. I have run the nipype.test(), and the only warnings I get are for packages that I do not have installed (Fuse and paramiko) and for test_multiproc_nondaemon.py.
  2. I have checked the output of spm.Info.name(), and that prints out 'SPM12'.
  3. I get the same 'No command "matlab"...' error regardless of whether I explicitly import matlab from the nipype.interfaces or not.

I also ran a general check in python to see if matlab existed:
python -c "import os; os.system("matlab")"
I get a NameError out that 'matlab' is not defined.

At this point I do not know what else to test out or how to even begin to go about fixing this. I have attached my nipype script if that helps at all.
pCASL-ASL-preprocessing.pdf

Thanks in advance,

suzanne

Actual behavior

Expected behavior

How to replicate the behavior

Script/Workflow details

/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
180820-15:12:25,544 nipype.workflow INFO:
	 Workflow preproc_wf settings: ['check', 'execution', 'logging', 'monitoring']
180820-15:12:25,556 nipype.workflow INFO:
	 Running serially.
180820-15:12:25,557 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.selectfiles" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/selectfiles".
180820-15:12:25,565 nipype.workflow INFO:
	 [Node] Running "selectfiles" ("nipype.interfaces.io.SelectFiles")
180820-15:12:25,573 nipype.workflow INFO:
	 [Node] Finished "preproc_wf.selectfiles".
180820-15:12:25,575 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.coreg_wf.bet_anat" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/coreg_wf/bet_anat".
180820-15:12:25,579 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.coreg_wf.bet_anat" - collecting precomputed outputs
180820-15:12:25,581 nipype.workflow INFO:
	 [Node] "preproc_wf.coreg_wf.bet_anat" found cached.
180820-15:12:25,585 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.coreg_wf.segmentation" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/coreg_wf/segmentation".
180820-15:12:25,589 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.coreg_wf.segmentation" - collecting precomputed outputs
180820-15:12:25,589 nipype.workflow INFO:
	 [Node] "preproc_wf.coreg_wf.segmentation" found cached.
180820-15:12:25,590 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.coreg_wf.threshold" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/coreg_wf/threshold".
180820-15:12:25,595 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.coreg_wf.threshold" - collecting precomputed outputs
180820-15:12:25,597 nipype.workflow INFO:
	 [Node] "preproc_wf.coreg_wf.threshold" found cached.
180820-15:12:25,599 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.fslroi" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/fslroi".
180820-15:12:25,603 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.fslroi" - collecting precomputed outputs
180820-15:12:25,604 nipype.workflow INFO:
	 [Node] "preproc_wf.fslroi" found cached.
180820-15:12:25,605 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.mcflirt" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/mcflirt".
180820-15:12:25,609 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.mcflirt" - collecting precomputed outputs
180820-15:12:25,610 nipype.workflow INFO:
	 [Node] "preproc_wf.mcflirt" found cached.
180820-15:12:25,611 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.coreg_wf.coreg_pre" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/coreg_wf/coreg_pre".
180820-15:12:25,619 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.coreg_wf.coreg_pre" - collecting precomputed outputs
180820-15:12:25,620 nipype.workflow INFO:
	 [Node] "preproc_wf.coreg_wf.coreg_pre" found cached.
180820-15:12:25,620 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.coreg_wf.coreg_bbr" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/coreg_wf/coreg_bbr".
180820-15:12:25,626 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.coreg_wf.coreg_bbr" - collecting precomputed outputs
180820-15:12:25,627 nipype.workflow INFO:
	 [Node] "preproc_wf.coreg_wf.coreg_bbr" found cached.
180820-15:12:25,628 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.coreg_wf.applywarp_mean" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/coreg_wf/applywarp_mean".
180820-15:12:25,636 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.coreg_wf.applywarp_mean" - collecting precomputed outputs
180820-15:12:25,636 nipype.workflow INFO:
	 [Node] "preproc_wf.coreg_wf.applywarp_mean" found cached.
180820-15:12:25,637 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.slicetimer" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/slicetimer".
180820-15:12:25,642 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.slicetimer" - collecting precomputed outputs
180820-15:12:25,642 nipype.workflow INFO:
	 [Node] "preproc_wf.slicetimer" found cached.
180820-15:12:25,643 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.coreg_wf.applywarp" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/coreg_wf/applywarp".
180820-15:12:25,651 nipype.workflow INFO:
	 [Node] Cached "preproc_wf.coreg_wf.applywarp" - collecting precomputed outputs
180820-15:12:25,651 nipype.workflow INFO:
	 [Node] "preproc_wf.coreg_wf.applywarp" found cached.
180820-15:12:25,652 nipype.workflow INFO:
	 [Node] Setting-up "preproc_wf.smooth" in "/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/smooth".
180820-15:12:25,660 nipype.workflow INFO:
	 [Node] Running "smooth" ("nipype.interfaces.spm.preprocess.Smooth")
180820-15:12:25,680 nipype.workflow WARNING:
	 [Node] Error on "preproc_wf.smooth" (/Users/switt/Documents/TBIMovie/workingdir/preproc_wf/smooth)
180820-15:12:25,685 nipype.workflow ERROR:
	 Node smooth failed to run on host ImageAnalystMacBook.local.
180820-15:12:25,687 nipype.workflow ERROR:
	 Saving crash info to /Users/switt/Documents/Nipype/crash-20180820-151225-switt-smooth-8eca116c-a6e4-46e9-9862-b63d13d432da.pklz
Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 44, in run
    node.run(updatehash=updatehash)
  File "/anaconda3/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 471, in run
    result = self._run_interface(execute=True)
  File "/anaconda3/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 555, in _run_interface
    return self._run_command(execute)
  File "/anaconda3/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_command
    result = self._interface.run(cwd=outdir)
  File "/anaconda3/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 521, in run
    runtime = self._run_interface(runtime)
  File "/anaconda3/lib/python3.6/site-packages/nipype/interfaces/spm/base.py", line 377, in _run_interface
    results = self.mlab.run()
  File "/anaconda3/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 521, in run
    runtime = self._run_interface(runtime)
  File "/anaconda3/lib/python3.6/site-packages/nipype/interfaces/matlab.py", line 162, in _run_interface
    runtime = super(MatlabCommand, self)._run_interface(runtime)
  File "/anaconda3/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 1024, in _run_interface
    runtime.hostname))
OSError: No command "matlab" found on host ImageAnalystMacBook.local. Please check that the corresponding package is installed.

180820-15:12:25,690 nipype.workflow INFO:
	 ***********************************
180820-15:12:25,690 nipype.workflow ERROR:
	 could not run node: preproc_wf.smooth
180820-15:12:25,691 nipype.workflow INFO:
	 crashfile: /Users/switt/Documents/Nipype/crash-20180820-151225-switt-smooth-8eca116c-a6e4-46e9-9862-b63d13d432da.pklz
180820-15:12:25,692 nipype.workflow INFO:
	 ***********************************
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-1-3a6002bce0e4> in <module>()
    207 
    208 # Run preprocess workflow
--> 209 preproc_wf.run()

/anaconda3/lib/python3.6/site-packages/nipype/pipeline/engine/workflows.py in run(self, plugin, plugin_args, updatehash)
    593         if str2bool(self.config['execution']['create_report']):
    594             self._write_report_info(self.base_dir, self.name, execgraph)
--> 595         runner.run(execgraph, updatehash=updatehash, config=self.config)
    596         datestr = datetime.utcnow().strftime('%Y%m%dT%H%M%S')
    597         if str2bool(self.config['execution']['write_provenance']):

/anaconda3/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py in run(self, graph, config, updatehash)
     59                 if self._status_callback:
     60                     self._status_callback(node, 'exception')
---> 61         report_nodes_not_run(notrun)

/anaconda3/lib/python3.6/site-packages/nipype/pipeline/plugins/tools.py in report_nodes_not_run(notrun)
     80                 logger.debug(subnode._id)
     81         logger.info("***********************************")
---> 82         raise RuntimeError(('Workflow did not execute cleanly. '
     83                             'Check log for details'))
     84 

RuntimeError: Workflow did not execute cleanly. Check log for details
Please put URL to code or code here (if not too long).

Platform details:

MacBook Pro running High Sierra (OS 10.13.6)

FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
{'commit_hash': '%h',
 'commit_source': 'archive substitution',
 'networkx_version': '2.1',
 'nibabel_version': '2.3.0',
 'nipype_version': '1.1.2',
 'numpy_version': '1.14.3',
 'pkg_path': '/anaconda3/lib/python3.6/site-packages/nipype',
 'scipy_version': '1.1.0',
 'sys_executable': '/anaconda3/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37) \n'
                '[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]',
 'traits_version': '4.6.0'}

Execution environment

Choose one

  • My python environment outside container - Jupyter notebook from local installation of Anaconda 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions