{"id":6401,"library":"nipype","title":"Neuroimaging in Python: Pipelines and Interfaces (Nipype)","description":"Nipype is a Python project that provides a uniform interface to existing neuroimaging software packages (e.g., FSL, SPM, AFNI, ANTS, FreeSurfer). It enables users to easily create and execute robust, reproducible, and efficient pipelines for neuroimaging data analysis. The current version is 1.11.0, and it maintains an active release cadence with regular feature and bug-fix updates.","status":"active","version":"1.11.0","language":"en","source_language":"en","source_url":"http://github.com/nipy/nipype","tags":["neuroimaging","pipeline","scientific-computing","mri","fmri","data-analysis"],"install":[{"cmd":"pip install nipype","lang":"bash","label":"Install Nipype"}],"dependencies":[{"reason":"Nipype requires Python 3.10 or newer.","package":"python","optional":false},{"reason":"Core dependency for scientific computing, support for NumPy 2.0+ was added in 1.9.1.","package":"numpy","optional":false},{"reason":"Used for reading/writing neuroimaging data formats. Compatibility with NiBabel 5+ was added in 1.8.6.","package":"nibabel","optional":false},{"reason":"Used for defining data structures and validating inputs. Specific version pinning is critical.","package":"traits","optional":false},{"reason":"Used for workflow graph management. Compatibility with NetworkX 3+ was added in 1.8.6.","package":"networkx","optional":false}],"imports":[{"symbol":"Workflow","correct":"from nipype.pipeline.engine import Workflow"},{"symbol":"Node","correct":"from nipype.pipeline.engine import Node"},{"symbol":"Function","correct":"from nipype.interfaces.utility import Function"},{"symbol":"IdentityInterface","correct":"from nipype.interfaces.utility import IdentityInterface"},{"note":"Interfaces are typically accessed via the package (e.g., 'fsl') within 'nipype.interfaces' rather than direct import from submodules, which can change.","wrong":"from nipype.interfaces.fsl import FSLCommand","symbol":"FSLCommand","correct":"from nipype.interfaces import fsl"}],"quickstart":{"code":"import os\nfrom nipype.pipeline.engine import Workflow, Node\nfrom nipype.interfaces.utility import Function, IdentityInterface\n\ndef simple_multiply(a, b):\n    return a * b\n\n# Create a workflow\nwf = Workflow(name=\"simple_math_workflow\")\nwf.base_dir = os.environ.get('NIPYPE_WORKDIR', os.path.abspath('nipype_work_dir'))\n\n# Input node to define initial data\ninputnode = Node(IdentityInterface(fields=['val1', 'val2']), name='inputnode')\ninputnode.inputs.val1 = 10\ninputnode.inputs.val2 = 5\n\n# Function node to perform multiplication\nmultiply_node = Node(Function(input_names=['a', 'b'],\n                              output_names=['result'],\n                              function=simple_multiply),\n                     name='multiply_node')\n\n# Connect the nodes\nwf.connect(inputnode, 'val1', multiply_node, 'a')\nwf.connect(inputnode, 'val2', multiply_node, 'b')\n\n# Run the workflow\ntry:\n    print(f\"Running workflow, output will be in {wf.base_dir}\")\n    # Use 'MultiProc' plugin for local parallel execution\n    wf.run(plugin='MultiProc')\n    print(\"Workflow completed successfully. Check the base_dir for results.\")\nexcept Exception as e:\n    print(f\"Workflow failed: {e}\")","lang":"python","description":"This quickstart demonstrates a basic Nipype workflow that takes two inputs, performs a simple multiplication using a custom Python function wrapped in a `Function` node, and executes the pipeline. Nipype workflows typically generate a working directory (`base_dir`) where intermediate and final results are stored. For complex workflows, consider `DataSink` or inspecting the cache for outputs."},"warnings":[{"fix":"Ensure all required external neuroimaging software packages are installed, correctly configured (e.g., in your PATH environment variable), and compatible with your operating system and Nipype version.","message":"Nipype interfaces *wrap* external neuroimaging software (e.g., FSL, SPM, AFNI, ANTS, FreeSurfer). These external tools must be installed and configured separately on your system; Nipype does not install them via pip. Incorrect or missing installations of these tools are a common source of errors.","severity":"breaking","affected_versions":"All versions"},{"fix":"Ensure your `traits` package version is less than 6.4. If you have `traits >= 6.4`, downgrade it using `pip install 'traits<6.4'` before installing or after installing Nipype.","message":"Version 1.8.4 pinned the `traits` dependency to `<6.4` to avoid breaking changes introduced in `traits` versions 6.4 and higher. Installing Nipype with a `traits` version >= 6.4 will likely lead to runtime errors.","severity":"breaking","affected_versions":"<1.8.4 (if not pinned), >=1.8.4 (if traits updated beyond <6.4)"},{"fix":"Refer to the Nipype documentation and examples for `InputSpec` and `OutputSpec` definitions. Pay close attention to field names, types (e.g., `File`, `traits.Bool`, `traits.Int`), and whether they are `mandatory`.","message":"Defining `InputSpec` and `OutputSpec` for custom `Function` nodes or custom interfaces can be complex for new users. Incorrectly defined fields or types can lead to validation errors or unexpected workflow behavior.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to Nipype 1.9.1 or newer for best compatibility with recent `numpy` versions. Ensure Python is 3.10+. If experiencing issues with `nibabel` or `networkx`, upgrade Nipype to 1.8.6 or newer.","message":"Nipype versions require Python 3.10 or newer. Additionally, `numpy` 2.0+ support was explicitly added in version 1.9.1, and compatibility with `nibabel` 4.x/5+ and `networkx` 3+ was addressed in versions 1.8.3 and 1.8.6 respectively.","severity":"breaking","affected_versions":"All versions before 1.9.1 for Numpy 2, before 1.8.6 for NiBabel 5/NetworkX 3, before 1.8.3 for NiBabel 4."},{"fix":"Upgrade to Nipype 1.11.0 or newer for improved error propagation. When debugging, carefully inspect logs for any hidden exceptions, even in older versions.","message":"Prior to version 1.11.0, errors encountered when using the `run_without_submitting` execution mode (often used for debugging or testing single nodes) might not have been properly propagated, leading to silent failures or unclear diagnostics.","severity":"gotcha","affected_versions":"<1.11.0"},{"fix":"Set `wf.base_dir` to a location with ample disk space. Utilize Nipype's logging and visualization tools (`graph.write_graph`) to understand workflow structure and execution. Manage disk space by deleting old `base_dir` contents when no longer needed.","message":"Nipype workflows generate extensive working directories (`base_dir`) for caching intermediate results. These directories can consume significant disk space and may contain many subfolders, making manual inspection challenging.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}