-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller.py
More file actions
81 lines (72 loc) · 2.65 KB
/
installer.py
File metadata and controls
81 lines (72 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python3
"""
Installer script for Phasers: Ghost in the Machine
GitHub Repo: https://github.com/oldwalls/phasers
"""
import os
import subprocess
import sys
import json
REPO_URL = "https://github.com/oldwalls/phasers.git"
PROJECT_DIR = "phasers"
UMB_FILE = "emergence_UMB.json"
# --- STEP 1: Clone the repo ---
def clone_repo():
if os.path.exists(PROJECT_DIR):
print(f"[✓] Repo folder '{PROJECT_DIR}' already exists.")
else:
print("[•] Cloning repo...")
subprocess.run(["git", "clone", REPO_URL], check=True)
# --- STEP 2: Set up virtual environment (optional but recommended) ---
def setup_venv():
print("[•] Setting up virtual environment...")
subprocess.run([sys.executable, "-m", "venv", "phasers_env"])
print("[✓] To activate: source phasers_env/bin/activate (Linux/macOS)")
print(" phasers_env\\Scripts\\activate (Windows)")
# --- STEP 3: Install dependencies ---
def install_requirements():
print("[•] Installing Python dependencies...")
deps = [
"transformers==4.40.0",
"torch", # assumes CUDA or CPU PyTorch will be handled by pip
"nltk",
"sentence-transformers",
]
subprocess.run([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
subprocess.run([sys.executable, "-m", "pip", "install", *deps], check=True)
# --- STEP 4: Download NLTK Punkt tokenizer if needed ---
def setup_nltk():
try:
import nltk
nltk.data.find("tokenizers/punkt")
print("[✓] NLTK Punkt already present.")
except (ImportError, LookupError):
print("[•] Downloading NLTK Punkt tokenizer...")
import nltk
nltk.download("punkt")
# --- STEP 5: Verify UMB JSON presence ---
def verify_umb():
umb_path = os.path.join(PROJECT_DIR, UMB_FILE)
if os.path.exists(umb_path):
print(f"[✓] Found memory UMB file: {UMB_FILE}")
else:
print(f"[!] WARNING: {UMB_FILE} not found. You may need to pull it from the repo or place it manually.")
# --- STEP 6: Final usage message ---
def launch_message():
print("\n🚀 Installation complete!\n")
print(f"→ To launch the chat interface:")
print(f" cd {PROJECT_DIR}")
print(f" python sapphire_chat.py")
print("\n🔮 Good luck, Operator. Phasers is listening...\n")
# --- RUN ALL STEPS ---
if __name__ == "__main__":
try:
clone_repo()
setup_venv()
install_requirements()
setup_nltk()
verify_umb()
launch_message()
except Exception as e:
print(f"[!] Install failed: {e}")
sys.exit(1)