Spaces:
Running on Zero
Running on Zero
Buffy commited on
Commit ·
accae83
1
Parent(s): 79019c5
Pick newest python for the searxng venv (master needs 3.11+; base has 3.10)
Browse files- searx_runtime.py +9 -2
searx_runtime.py
CHANGED
|
@@ -63,8 +63,15 @@ def _venv_python() -> str | None:
|
|
| 63 |
py = os.path.join(VENV_DIR, "bin", "python")
|
| 64 |
if os.path.exists(py):
|
| 65 |
return py
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
_log("venv creation failed")
|
| 69 |
return None
|
| 70 |
_log("installing searxng deps (this takes a few minutes on first boot)")
|
|
|
|
| 63 |
py = os.path.join(VENV_DIR, "bin", "python")
|
| 64 |
if os.path.exists(py):
|
| 65 |
return py
|
| 66 |
+
# Prefer the newest interpreter available (SearXNG master needs 3.11+;
|
| 67 |
+
# the container base image ships 3.10).
|
| 68 |
+
base = None
|
| 69 |
+
for cand in ("python3.13", "python3.12", "python3.11", "python3"):
|
| 70 |
+
if shutil.which(cand):
|
| 71 |
+
base = cand
|
| 72 |
+
break
|
| 73 |
+
_log(f"creating venv with {base}")
|
| 74 |
+
if not base or subprocess.run([base, "-m", "venv", VENV_DIR], capture_output=True).returncode != 0:
|
| 75 |
_log("venv creation failed")
|
| 76 |
return None
|
| 77 |
_log("installing searxng deps (this takes a few minutes on first boot)")
|