From 362fe661f95ae3f0bac5b9de912d22cbfc77bb67 Mon Sep 17 00:00:00 2001 From: Chaakh Date: Sun, 23 Aug 2026 10:26:10 +0200 Subject: [PATCH] fix: spawn main.py with sys.executable, not bare "python" The job runner built its command as ["python", "-u", "main.py"], which resolves against PATH. Inside the Docker image there is exactly one interpreter so it works, but in the documented non-Docker install -- a venv -- PATH points at whatever Python came first, not the one running the server. Every job then dies immediately: ModuleNotFoundError: No module named 'cv2' The CLI works fine in the same checkout, so it presents as "the dashboard is broken" rather than anything to do with interpreters. _run_quality_probe five hundred lines up already uses sys.executable for exactly this reason; this makes the two agree. Verified: same job, same venv, failed before and completed after. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01QiYkHKB7Tp7X6NdnEutda2 --- app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 39a08e4..9897f1b 100644 --- a/app.py +++ b/app.py @@ -1670,7 +1670,11 @@ async def process_endpoint( os.makedirs(job_output_dir, exist_ok=True) # Prepare Command - cmd = ["python", "-u", "main.py"] # -u for unbuffered + # sys.executable, not "python": bare "python" resolves against PATH, which + # outside Docker is whatever interpreter happens to be first — not the venv + # running this server. Every job then dies on `import cv2`. The quality + # probe above already gets this right. + cmd = [sys.executable, "-u", "main.py"] # -u for unbuffered env = os.environ.copy() env["GEMINI_API_KEY"] = api_key # Override with key from request