diff --git a/Cargo.lock b/Cargo.lock index f074414b8..3ad9cc273 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1491,6 +1491,7 @@ dependencies = [ "tracing", "tracing-opentelemetry", "uuid", + "which", ] [[package]] diff --git a/binaries/daemon/Cargo.toml b/binaries/daemon/Cargo.toml index f580ca308..e2ca4fab4 100644 --- a/binaries/daemon/Cargo.toml +++ b/binaries/daemon/Cargo.toml @@ -39,3 +39,4 @@ bincode = "1.3.3" async-trait = "0.1.64" arrow-schema = { workspace = true } aligned-vec = "0.5.0" +which = "4.3.0" diff --git a/binaries/daemon/src/spawn.rs b/binaries/daemon/src/spawn.rs index 1a79bda09..e1e25a776 100644 --- a/binaries/daemon/src/spawn.rs +++ b/binaries/daemon/src/spawn.rs @@ -137,7 +137,12 @@ pub async fn spawn_node( let mut command = if has_python_operator && !has_other_operator { // Use python to spawn runtime if there is a python operator - let mut command = tokio::process::Command::new("python3"); + let python = match which::which("python3") { + Ok(python) => python, + Err(_) => which::which("python") + .context("failed to find `python` or `python3` in dora-daemon path. Make sure that python is available for the daemon.")?, + }; + let mut command = tokio::process::Command::new(python); command.args([ "-c", format!("import dora; dora.start_runtime() # {}", node.id).as_str(),