Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Print helpful error message when flask isn't available

Kilian Lieretd6fc343ae952
diff --git a/sweagent/api/server.py b/sweagent/api/server.py
index 55fc0229..398e8d22 100644
--- a/sweagent/api/server.py
+++ b/sweagent/api/server.py
@@ -1,3 +1,11 @@
+try:
+ import flask # noqa
+except ImportError as e:
+ msg = (
+ "Flask not found. You probably haven't installed the dependencies for SWE-agent. "
+ "Please go to the root of the repository and run `pip install -e .`"
+ )
+ raise RuntimeError(msg) from e
from contextlib import redirect_stderr, redirect_stdout
import os
import time