fix(deps): make torch/ML stack opt-in instead of a mandatory install
requirements-amd.txt/requirements-nvidia.txt were pulling a multi-GB torch wheel by default even though nothing in synapse/ imports torch, transformers, accelerate, bitsandbytes, or PySide6 - dead weight that made the pip batch fragile (one failed download could take unrelated base deps down with it on a slow connection). Split the unused ML/GUI stack out of requirements-base.txt into a new opt-in requirements-ml.txt, and dropped the torch lines from the AMD/NVIDIA overlays and generator. Also: recreate the venv if it exists but pip is missing, instead of silently reusing a half-built one (ensurepip can fail during venv creation and leave an interpreter with no pip). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
409e384be0
commit
3b0354735c
+10
@@ -61,6 +61,16 @@ def venv_python() -> Path:
|
||||
"""Path to the Promethean interpreter, creating the venv if it's missing."""
|
||||
venv = ROOT / "Promethean"
|
||||
py = venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python")
|
||||
if py.exists() and subprocess.run(
|
||||
[str(py), "-m", "pip", "--version"], capture_output=True).returncode:
|
||||
# venv creation can partially succeed: the interpreter gets built but
|
||||
# ensurepip's bootstrap fails (e.g. the matching pythonX.Y-venv package
|
||||
# wasn't installed yet), leaving pip missing. Existence of `py` alone
|
||||
# can't tell a venv like that apart from a good one, so a prior failed
|
||||
# run would otherwise be reused forever instead of getting rebuilt now
|
||||
# that whatever broke ensurepip is fixed.
|
||||
print("Existing venv has no pip - recreating it...")
|
||||
shutil.rmtree(venv)
|
||||
if not py.exists():
|
||||
result = subprocess.run([sys.executable, "-m", "venv", str(venv)])
|
||||
if result.returncode:
|
||||
|
||||
Reference in New Issue
Block a user