Run Notebook

Run a local Jupyter Notebook (.ipynb) using Python script

Overview

This node runs a local Jupyter Notebook (.ipynb) file by executing a Python script. It is useful for automating the execution of notebooks within an n8n workflow, allowing users to run data analysis, machine learning models, or any notebook-based tasks programmatically. For example, a user can specify the full path to a notebook, and the node will run it and return the output or any error messages.

Use Case Examples

  1. Automate running a data analysis notebook and capture the results in a workflow.
  2. Run a machine learning training notebook and log the output for monitoring.

Properties

Name Meaning
Notebook Full Path The full file path to the Jupyter Notebook (.ipynb) to be executed.

Output

JSON

  • notebookPath - The full path of the notebook that was run.
  • result - The standard output from running the notebook via the Python script, containing execution results or logs.
  • error - Error message if the notebook execution failed.

Dependencies

  • Requires Python to be installed on the system.
  • Requires a Python script named 'run_notebook.py' to be present and accessible, which handles the actual notebook execution.

Troubleshooting

  • Ensure the 'notebookPath' is correct and the file exists at the specified location.
  • Make sure Python is installed and accessible from the command line where n8n runs.
  • Verify that the 'run_notebook.py' script is present and correctly implemented to run the notebook.
  • Common error messages include file not found errors for the notebook or Python script, and Python execution errors. Check the error message returned in the output for details.

Discussion