-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
851 lines (707 loc) · 30.1 KB
/
install.py
File metadata and controls
851 lines (707 loc) · 30.1 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
#!/usr/bin/env python3
"""
VOXIS V4.0.0 DENSE — Cross-Platform Installer
Copyright © 2026 Glass Stone LLC. All Rights Reserved.
CEO: Gabriel B. Rodriguez
Auto-installs Python 3.11 venv, all pip dependencies, verifies bundled
ML models (~9.7 GB hard-coded locally), builds the PyInstaller sidecar
binary, and installs the Tauri frontend.
All models are pre-installed — no network access required. Fully offline.
Python 3.11 is auto-detected or installed via Homebrew on macOS.
Supports: macOS (arm64/x86_64) and Windows (x64).
Usage:
python3 install.py # Full install
python3 install.py --models # Verify bundled models
python3 install.py --deps # Install Python deps only
python3 install.py --build # Build sidecar binary only
python3 install.py --check # Verify installation
"""
import os
import sys
import shutil
import platform
import subprocess
import json
import time
import argparse
from pathlib import Path
# ── Constants ─────────────────────────────────────────────────────────────
INSTALL_DIR = Path(__file__).resolve().parent
ENGINE_DIR = INSTALL_DIR / "trinity_engine"
APP_DIR = INSTALL_DIR / "app"
VENV_DIR = INSTALL_DIR / "venv"
IS_WINDOWS = platform.system() == "Windows"
IS_MACOS = platform.system() == "Darwin"
IS_LINUX = platform.system() == "Linux"
ARCH = platform.machine()
# Hard-coded Python 3.11 paths — search for best available
PYTHON = "python" if IS_WINDOWS else "python3"
PYTHON_CANDIDATES = (
[r"C:\Python311\python.exe", r"C:\Program Files\Python311\python.exe", "python3.11", "python"]
if IS_WINDOWS else
["/opt/homebrew/bin/python3.11", "/usr/local/bin/python3.11", "python3.11", "python3"]
)
PIP = None # Set after venv creation
def _find_python():
"""Find the best Python 3.10+ interpreter."""
global PYTHON
for candidate in PYTHON_CANDIDATES:
full = shutil.which(candidate) or candidate
if os.path.isfile(full):
try:
ver = subprocess.check_output([full, "--version"], text=True, stderr=subprocess.STDOUT).strip()
parts = ver.split()[-1].split(".")
if int(parts[0]) >= 3 and int(parts[1]) >= 10:
PYTHON = full
return full
except Exception:
continue
return PYTHON
MIN_PYTHON = (3, 10)
MIN_DISK_GB = 15
TOTAL_MODEL_SIZE_GB = 9.7
# Tauri sidecar target triples
TARGET_TRIPLE = {
("Darwin", "arm64"): "aarch64-apple-darwin",
("Darwin", "x86_64"): "x86_64-apple-darwin",
("Windows", "AMD64"): "x86_64-pc-windows-msvc",
("Windows", "x86_64"): "x86_64-pc-windows-msvc",
("Linux", "x86_64"): "x86_64-unknown-linux-gnu",
("Linux", "aarch64"): "aarch64-unknown-linux-gnu",
}
# ── Colors (ANSI, disabled on Windows unless modern terminal) ─────────────
if IS_WINDOWS:
# Enable ANSI on Windows 10+
try:
import ctypes
kernel32 = ctypes.windll.kernel32
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
HAS_COLOR = True
except Exception:
HAS_COLOR = False
else:
HAS_COLOR = True
def _c(code, text):
return f"\033[{code}m{text}\033[0m" if HAS_COLOR else text
RED = lambda t: _c("0;31", t)
GREEN = lambda t: _c("0;32", t)
YELLOW = lambda t: _c("1;33", t)
BLUE = lambda t: _c("0;34", t)
CYAN = lambda t: _c("0;36", t)
BOLD = lambda t: _c("1", t)
# ── Logging ───────────────────────────────────────────────────────────────
TOTAL_STEPS = 7
_current_step = 0
def banner():
print()
print(CYAN("╔══════════════════════════════════════════════════════════════╗"))
print(CYAN("║") + " " + BOLD("VOXIS 4.0 DENSE") + " — Cross-Platform Installer " + CYAN("║"))
print(CYAN("║") + " Powered by Trinity V8.2 " + CYAN("║"))
print(CYAN("║") + " © 2026 Glass Stone LLC — CEO: Gabriel B. Rodriguez " + CYAN("║"))
print(CYAN("╚══════════════════════════════════════════════════════════════╝"))
print()
def step(title, detail=""):
global _current_step
_current_step += 1
print(f"\n{BLUE(f'[{_current_step}/{TOTAL_STEPS}]')} {BOLD(title)}")
if detail:
print(f" {YELLOW(detail)}")
def ok(msg):
print(f" {GREEN('✓')} {msg}")
def warn(msg):
print(f" {YELLOW('⚠')} {msg}")
def fail(msg):
print(f" {RED('✗')} {msg}")
print(f" {RED('Installation aborted.')}")
sys.exit(1)
def run(cmd, **kwargs):
"""Run a subprocess, return CompletedProcess. Raises on failure unless check=False."""
kwargs.setdefault("check", True)
kwargs.setdefault("capture_output", True)
kwargs.setdefault("text", True)
try:
return subprocess.run(cmd, **kwargs)
except subprocess.CalledProcessError as e:
if kwargs.get("check"):
print(f" Command failed: {' '.join(str(c) for c in cmd)}")
if e.stdout:
print(f" stdout: {e.stdout[:500]}")
if e.stderr:
print(f" stderr: {e.stderr[:500]}")
raise
return e
except FileNotFoundError:
return None
def pip_install(*packages, quiet=True):
"""Install pip packages into the venv."""
cmd = [str(PIP), "install"] + list(packages)
if quiet:
cmd.append("--quiet")
run(cmd)
# ── Step 1: System Requirements ───────────────────────────────────────────
def check_system():
step("Checking System Requirements",
f"{platform.system()} {ARCH}, Python {MIN_PYTHON[0]}.{MIN_PYTHON[1]}+, FFmpeg...")
# OS
if IS_MACOS:
try:
ver = subprocess.check_output(["sw_vers", "-productVersion"], text=True).strip()
major = int(ver.split(".")[0])
if major < 12:
fail(f"macOS 12+ required (found {ver})")
ok(f"macOS {ver}")
except Exception:
warn("Could not determine macOS version")
elif IS_WINDOWS:
ver = platform.version()
ok(f"Windows {platform.release()} (build {ver})")
elif IS_LINUX:
ok(f"Linux {platform.release()}")
else:
warn(f"Untested platform: {platform.system()}")
ok(f"Architecture: {ARCH}")
# Python — find best 3.10+ interpreter (prefer 3.11)
found_py = _find_python()
try:
ver_out = subprocess.check_output([found_py, "--version"], text=True).strip()
ok(f"{ver_out} ({found_py})")
except Exception:
py_ver = sys.version_info
if py_ver >= MIN_PYTHON:
ok(f"Python {py_ver.major}.{py_ver.minor}.{py_ver.micro}")
else:
if IS_MACOS and shutil.which("brew"):
warn("Python 3.10+ not found. Installing Python 3.11 via Homebrew...")
try:
run(["brew", "install", "[email protected]"], capture_output=False)
_find_python()
ok("Python 3.11 installed via Homebrew")
except Exception:
fail("Failed to install Python 3.11. Run: brew install [email protected]")
else:
fail(f"Python {MIN_PYTHON[0]}.{MIN_PYTHON[1]}+ required "
f"(found {py_ver.major}.{py_ver.minor}). Install from python.org")
# FFmpeg
ffmpeg_path = shutil.which("ffmpeg")
if ffmpeg_path:
try:
ff_ver = subprocess.check_output(
["ffmpeg", "-version"], text=True, stderr=subprocess.STDOUT
).split("\n")[0]
ok(f"FFmpeg found: {ff_ver.split(' ')[2] if len(ff_ver.split(' ')) > 2 else 'installed'}")
except Exception:
ok("FFmpeg found")
else:
if IS_MACOS:
warn("FFmpeg not found. Attempting install via Homebrew...")
if shutil.which("brew"):
try:
run(["brew", "install", "ffmpeg"])
ok("FFmpeg installed via Homebrew")
except Exception:
fail("Failed to install FFmpeg. Run: brew install ffmpeg")
else:
fail("FFmpeg required. Install Homebrew first, then: brew install ffmpeg")
elif IS_WINDOWS:
warn("FFmpeg not found on PATH.")
_install_ffmpeg_windows()
else:
fail("FFmpeg required. Install via your package manager (apt install ffmpeg)")
# Node.js
node_path = shutil.which("node")
if node_path:
try:
node_ver = subprocess.check_output(["node", "--version"], text=True).strip()
ok(f"Node.js {node_ver}")
except Exception:
ok("Node.js found")
else:
warn("Node.js not found. Frontend build will be skipped.")
# Disk space
try:
usage = shutil.disk_usage(str(INSTALL_DIR))
avail_gb = usage.free / (1024 ** 3)
if avail_gb < MIN_DISK_GB:
warn(f"Low disk space: {avail_gb:.1f} GB available ({MIN_DISK_GB} GB+ recommended)")
else:
ok(f"Disk space: {avail_gb:.0f} GB available")
except Exception:
warn("Could not determine disk space")
# RAM
try:
import psutil
ram_gb = psutil.virtual_memory().total / (1024 ** 3)
ok(f"RAM: {ram_gb:.0f} GB")
except ImportError:
try:
if IS_MACOS:
mem = int(subprocess.check_output(["sysctl", "-n", "hw.memsize"], text=True).strip())
ok(f"RAM: {mem / (1024**3):.0f} GB")
elif IS_WINDOWS:
r = run(["wmic", "computersystem", "get", "TotalPhysicalMemory", "/value"], check=False)
if r and r.stdout:
for line in r.stdout.strip().split("\n"):
if "TotalPhysicalMemory" in line:
mem = int(line.split("=")[1])
ok(f"RAM: {mem / (1024**3):.0f} GB")
break
except Exception:
pass
def _install_ffmpeg_windows():
"""Download and install FFmpeg on Windows."""
ffmpeg_dir = INSTALL_DIR / "tools" / "ffmpeg"
ffmpeg_exe = ffmpeg_dir / "ffmpeg.exe"
if ffmpeg_exe.exists():
ok(f"FFmpeg already at {ffmpeg_exe}")
_add_to_path(str(ffmpeg_dir))
return
print(" Downloading FFmpeg for Windows...")
try:
import urllib.request
import zipfile
import io
url = "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip"
print(f" Source: {url}")
print(" This may take a minute...")
with urllib.request.urlopen(url, timeout=120) as resp:
data = resp.read()
ffmpeg_dir.mkdir(parents=True, exist_ok=True)
with zipfile.ZipFile(io.BytesIO(data)) as zf:
for member in zf.namelist():
if member.endswith("/bin/ffmpeg.exe"):
with zf.open(member) as src, open(ffmpeg_exe, "wb") as dst:
dst.write(src.read())
elif member.endswith("/bin/ffprobe.exe"):
probe = ffmpeg_dir / "ffprobe.exe"
with zf.open(member) as src, open(probe, "wb") as dst:
dst.write(src.read())
if ffmpeg_exe.exists():
_add_to_path(str(ffmpeg_dir))
ok(f"FFmpeg installed to {ffmpeg_dir}")
else:
fail("FFmpeg extraction failed. Download manually from https://ffmpeg.org/download.html")
except Exception as e:
fail(f"FFmpeg download failed: {e}\n"
" Download manually from https://ffmpeg.org/download.html "
"and add to PATH.")
def _add_to_path(directory):
"""Add a directory to the current process PATH."""
current = os.environ.get("PATH", "")
if directory not in current:
os.environ["PATH"] = directory + os.pathsep + current
# ── Step 2: Python Virtual Environment ────────────────────────────────────
def setup_venv():
global PIP
step("Creating Python Virtual Environment", str(VENV_DIR))
if VENV_DIR.exists():
warn("Existing venv found. Reusing.")
else:
run([PYTHON, "-m", "venv", str(VENV_DIR)])
ok(f"Virtual environment created (using {PYTHON})")
# Determine pip/python paths inside venv
if IS_WINDOWS:
venv_python = VENV_DIR / "Scripts" / "python.exe"
PIP = VENV_DIR / "Scripts" / "pip.exe"
else:
venv_python = VENV_DIR / "bin" / "python3"
PIP = VENV_DIR / "bin" / "pip"
if not PIP.exists():
# Fallback
PIP = VENV_DIR / "Scripts" / "pip" if IS_WINDOWS else VENV_DIR / "bin" / "pip"
ok(f"Activated venv ({venv_python})")
# Upgrade pip
run([str(PIP), "install", "--upgrade", "pip", "--quiet"])
ok("pip upgraded")
# ── Step 3: Install Python Dependencies ───────────────────────────────────
def install_deps():
step("Installing ML Dependencies",
"torch, torchaudio, audio-separator, audiosr, voicerestore...")
# PyTorch (CPU-only on macOS/Windows by default; CUDA users can override)
print(" Installing PyTorch 2.6.0 (this may take a few minutes)...")
pip_install("torch==2.6.0", "torchaudio==2.6.0", "torchvision==0.21.0")
ok("PyTorch 2.6.0 + torchaudio + torchvision")
# Core audio
pip_install("pedalboard", "numpy==1.23.5", "soundfile", "librosa==0.9.2",
"scipy>=1.14.1", "resampy==0.4.3", "soxr==1.0.0", "pydub==0.25.1",
"pyloudnorm")
ok("Audio processing libs")
# Source separation
pip_install("audio-separator>=0.14.3")
ok("audio-separator (BS-RoFormer)")
# AudioSR
pip_install("audiosr>=0.0.7", "matplotlib>=3.9.0")
ok("AudioSR (neural super-resolution)")
# VoiceRestore transitive deps
pip_install("huggingface_hub>=0.24.6", "x-transformers>=2.16.2",
"gateloop-transformer>=0.2.5", "jaxtyping>=0.3.9",
"torchdiffeq>=0.2.4", "rotary-embedding-torch>=0.6.5",
"einops>=0.8.2")
ok("VoiceRestore transformer deps")
# Inference utilities
pip_install("safetensors>=0.7.0", "tokenizers>=0.13.3",
"transformers>=4.30.2", "omegaconf>=2.3.0")
ok("Inference utilities")
# Platform-specific acceleration
if IS_MACOS and ARCH == "arm64":
pip_install("coremltools>=9.0", "scikit-learn==1.5.1")
ok("CoreML + scikit-learn (Apple Neural Engine)")
pip_install("onnxruntime>=1.24.0")
ok("ONNX Runtime")
elif IS_WINDOWS:
pip_install("onnxruntime-directml>=1.16.0")
ok("ONNX Runtime DirectML (GPU acceleration)")
else:
pip_install("onnxruntime>=1.24.0")
ok("ONNX Runtime")
# System & telemetry
pip_install("psutil>=7.0.0", "requests>=2.32.0", "certifi>=2026.2.25",
"filelock>=3.25.0", "packaging>=23.2", "tqdm>=4.66.0",
"PyYAML>=6.0.0")
ok("System utilities")
# Build tools
pip_install("setuptools>=69.5.1")
ok("Build tools")
# Full requirements.txt as safety net
req_file = INSTALL_DIR / "requirements.txt"
if req_file.exists():
try:
pip_install("-r", str(req_file))
ok("All requirements.txt deps verified")
except Exception:
warn("Some requirements.txt deps failed (non-critical)")
ok("All dependencies installed")
# ── Step 4: Download ML Models ────────────────────────────────────────────
def verify_models():
step("Verifying Bundled ML Models",
"All models are hard-coded locally — no download required.")
venv_py = str(VENV_DIR / ("Scripts" if IS_WINDOWS else "bin") /
("python.exe" if IS_WINDOWS else "python3"))
registry = ENGINE_DIR / "model_registry.py"
if registry.exists():
try:
result = run(
[venv_py, str(registry)],
capture_output=False,
cwd=str(ENGINE_DIR),
check=False,
)
if result and result.returncode == 0:
ok("All bundled models verified (fully offline — no network required)")
else:
warn("Some models may be missing from the bundle.")
except Exception:
warn("Model verification skipped")
else:
warn("model_registry.py not found")
# ── Step 5: Verify Pipeline ──────────────────────────────────────────────
def verify_pipeline():
step("Verifying Trinity V8.2 Pipeline", "Testing all module imports...")
venv_py = str(VENV_DIR / ("Scripts" if IS_WINDOWS else "bin") /
("python.exe" if IS_WINDOWS else "python3"))
verify_script = """
import sys, os
sys.path.insert(0, os.getcwd())
modules = [
'modules.ingest', 'modules.device_utils', 'modules.pipeline_cache',
'modules.retry_engine', 'modules.error_telemetry',
'modules.spectrum_analyzer', 'modules.uvr_processor',
'modules.voicerestore_wrapper', 'modules.upsampler',
'modules.mastering_phase'
]
failed = 0
for m in modules:
try:
__import__(m)
except Exception as e:
print(f' FAIL: {m}: {e}')
failed += 1
if failed > 0:
print(f'{failed} modules failed to import')
sys.exit(1)
print(f'All {len(modules)} modules loaded successfully.')
"""
try:
result = run(
[venv_py, "-c", verify_script],
capture_output=False,
cwd=str(ENGINE_DIR),
check=False,
)
if result and result.returncode == 0:
ok("All pipeline modules verified")
else:
warn("Some modules failed to import (models may not be downloaded yet)")
except Exception:
warn("Pipeline verification skipped")
# ── Step 6: Build Sidecar Binary ─────────────────────────────────────────
def build_sidecar():
step("Building Trinity V8.2 Sidecar Binary", "PyInstaller → single executable...")
venv_pip = str(PIP)
venv_py = str(VENV_DIR / ("Scripts" if IS_WINDOWS else "bin") /
("python.exe" if IS_WINDOWS else "python3"))
# Install PyInstaller
pip_install("pyinstaller")
ok("PyInstaller installed")
spec_name = "trinity_v8_core_win.spec" if IS_WINDOWS else "trinity_v8_core.spec"
spec_file = INSTALL_DIR / spec_name
if not spec_file.exists():
warn(f"PyInstaller spec not found ({spec_file}). Skipping sidecar build.")
warn("The sidecar binary must be built separately.")
return
# Ensure critical build deps
pip_install("setuptools==69.5.1", "numpy<2.0")
print(" Building sidecar (this may take 5-10 minutes)...")
try:
result = run(
[venv_py, "-m", "PyInstaller", str(spec_file), "--noconfirm"],
capture_output=False,
cwd=str(INSTALL_DIR),
check=False,
)
if result and result.returncode != 0:
warn("Sidecar build had issues. Check output above.")
return
# Copy to Tauri binaries dir
triple = TARGET_TRIPLE.get((platform.system(), ARCH))
if not triple:
warn(f"Unknown target triple for {platform.system()}/{ARCH}")
return
src_name = "trinity_v8_core.exe" if IS_WINDOWS else "trinity_v8_core"
src = INSTALL_DIR / "dist" / ("trinity_v8_core" if not IS_WINDOWS else "trinity_v8_core.exe")
# PyInstaller may output to dist/trinity_v8_core/ (onedir) or dist/trinity_v8_core (onefile)
if not src.exists():
src = INSTALL_DIR / "dist" / "trinity_v8_core" / src_name
if not src.exists():
warn(f"Built binary not found at expected path. Check dist/ directory.")
return
dest_name = f"trinity_v8_core-{triple}" + (".exe" if IS_WINDOWS else "")
dest_dir = APP_DIR / "src-tauri" / "binaries"
dest_dir.mkdir(parents=True, exist_ok=True)
dest = dest_dir / dest_name
shutil.copy2(str(src), str(dest))
size_mb = dest.stat().st_size / (1024 * 1024)
ok(f"Sidecar binary: {dest} ({size_mb:.0f} MB)")
except Exception as e:
warn(f"Sidecar build failed: {e}")
warn("You can rebuild later: pyinstaller trinity_v8_core.spec --noconfirm")
# ── Step 7: Frontend Dependencies ─────────────────────────────────────────
def install_frontend():
step("Installing Frontend Dependencies", "React + Tauri...")
if not (APP_DIR / "package.json").exists():
warn("app/package.json not found. Skipping frontend.")
return
if not shutil.which("npm"):
warn("npm not found. Skipping frontend install.")
return
try:
run(["npm", "install"], capture_output=False, cwd=str(APP_DIR), check=False)
ok("Frontend dependencies installed")
except Exception as e:
warn(f"Frontend install failed: {e}")
# ── Launchers ─────────────────────────────────────────────────────────────
def create_launchers():
if IS_MACOS or IS_LINUX:
_create_unix_launchers()
elif IS_WINDOWS:
_create_windows_launchers()
def _create_unix_launchers():
launcher = INSTALL_DIR / "VOXIS.command"
launcher.write_text(f"""#!/bin/bash
# VOXIS 4.0 DENSE Launcher — Glass Stone LLC
DIR="$(cd "$(dirname "$0")" && pwd)"
source "$DIR/venv/bin/activate"
export PYTORCH_ENABLE_MPS_FALLBACK=1
echo ">> [VOXIS] Starting Trinity V8.2 Engine..."
echo ">> [VOXIS] Platform: $(uname -s) $(uname -m)"
if command -v npm &>/dev/null && [ -f "$DIR/app/package.json" ]; then
cd "$DIR/app"
npm run tauri dev 2>&1
else
echo ">> [VOXIS] Running in CLI mode."
cd "$DIR/trinity_engine"
exec bash
fi
""")
launcher.chmod(0o755)
cli = INSTALL_DIR / "voxis-cli.sh"
cli.write_text(f"""#!/bin/bash
# VOXIS CLI — processes audio from the command line
DIR="$(cd "$(dirname "$0")" && pwd)"
source "$DIR/venv/bin/activate"
export PYTORCH_ENABLE_MPS_FALLBACK=1
cd "$DIR/trinity_engine"
python3 trinity_core.py "$@"
""")
cli.chmod(0o755)
ok("Launchers: VOXIS.command, voxis-cli.sh")
def _create_windows_launchers():
launcher = INSTALL_DIR / "VOXIS.bat"
launcher.write_text(f"""@echo off
REM VOXIS 4.0 DENSE Launcher — Glass Stone LLC
setlocal
set "DIR=%~dp0"
call "%DIR%venv\\Scripts\\activate.bat"
echo >> [VOXIS] Starting Trinity V8.2 Engine...
echo >> [VOXIS] Platform: Windows {ARCH}
if exist "%DIR%app\\package.json" (
if exist "%DIR%tools\\ffmpeg" set "PATH=%DIR%tools\\ffmpeg;%PATH%"
cd /d "%DIR%app"
npm run tauri dev
) else (
echo >> [VOXIS] Running in CLI mode.
cd /d "%DIR%trinity_engine"
cmd /k
)
""")
cli = INSTALL_DIR / "voxis-cli.bat"
cli.write_text(f"""@echo off
REM VOXIS CLI — processes audio from the command line
setlocal
set "DIR=%~dp0"
call "%DIR%venv\\Scripts\\activate.bat"
if exist "%DIR%tools\\ffmpeg" set "PATH=%DIR%tools\\ffmpeg;%PATH%"
cd /d "%DIR%trinity_engine"
python trinity_core.py %*
""")
ok("Launchers: VOXIS.bat, voxis-cli.bat")
# ── Check Installation ────────────────────────────────────────────────────
def check_installation():
print(f"\n{BOLD('=== VOXIS Installation Status ===')}\n")
checks = {
"Python venv": VENV_DIR.exists(),
"pip": PIP is not None and Path(str(PIP)).exists() if PIP else VENV_DIR.exists(),
"FFmpeg": shutil.which("ffmpeg") is not None,
"Node.js": shutil.which("node") is not None,
}
# Check sidecar
triple = TARGET_TRIPLE.get((platform.system(), ARCH), "unknown")
ext = ".exe" if IS_WINDOWS else ""
sidecar = APP_DIR / "src-tauri" / "binaries" / f"trinity_v8_core-{triple}{ext}"
checks["Sidecar binary"] = sidecar.exists()
# Check models
home = Path.home()
models_dir = home / ".voxis" / "dependencies" / "models"
dev_models = ENGINE_DIR / "dependencies" / "models"
checks["Models directory"] = models_dir.exists() or dev_models.exists()
for name, installed in checks.items():
icon = GREEN("[OK]") if installed else RED("[ ]")
print(f" {icon} {name}")
# Check model detail via registry
try:
sys.path.insert(0, str(ENGINE_DIR))
from model_registry import check_all_models
status = check_all_models()
print(f"\n Models: {status['total_size_mb']/1024:.1f} GB total, "
f"{status['missing_size_mb']/1024:.1f} GB missing")
for m in status["models"]:
icon = GREEN("[OK]") if m["installed"] else RED("[ ]")
print(f" {icon} {m['name']} ({m['size_mb']} MB)")
except Exception:
pass
print()
# ── Completion Banner ─────────────────────────────────────────────────────
def complete_banner():
print()
print(GREEN("╔══════════════════════════════════════════════════════════════╗"))
print(GREEN("║") + " " + BOLD("✓ VOXIS 4.0 DENSE — Installation Complete!") + " " + GREEN("║"))
print(GREEN("╚══════════════════════════════════════════════════════════════╝"))
print()
print(f" {BOLD('Build the desktop app:')}")
print(f" {CYAN('•')} python3 install.py --app")
print(f" {CYAN('•')} Or: make build")
print()
print(f" {BOLD('Run in development mode:')}")
print(f" {CYAN('•')} cd app && npm run tauri:dev")
print(f" {CYAN('•')} Or: make dev")
print()
if IS_WINDOWS:
print(f" {BOLD('CLI mode:')}")
print(f" {CYAN('•')} voxis-cli.bat --input audio.wav --output restored.wav")
else:
print(f" {BOLD('CLI mode:')}")
print(f" {CYAN('•')} ./voxis-cli.sh --input audio.wav --output restored.wav")
print()
print(f" © 2026 Glass Stone LLC — CEO: Gabriel B. Rodriguez")
print()
# ── Main ──────────────────────────────────────────────────────────────────
def main():
parser = argparse.ArgumentParser(
description="VOXIS V4.0.0 DENSE — Cross-Platform Installer"
)
parser.add_argument("--models", action="store_true",
help="Verify bundled ML models")
parser.add_argument("--deps", action="store_true",
help="Install Python dependencies only")
parser.add_argument("--build", action="store_true",
help="Build sidecar binary only")
parser.add_argument("--check", action="store_true",
help="Check installation status")
parser.add_argument("--no-build", action="store_true",
help="Skip sidecar binary build")
parser.add_argument("--app", action="store_true",
help="Build the full desktop app (sidecar + Tauri bundle)")
args = parser.parse_args()
banner()
# Partial modes
if args.check:
setup_venv()
check_installation()
return
if args.models:
setup_venv()
verify_models()
return
if args.deps:
setup_venv()
install_deps()
return
if args.build:
setup_venv()
build_sidecar()
return
if args.app:
# Full desktop app build: deps → sidecar → Tauri bundle
global _current_step
check_system()
setup_venv()
install_deps()
verify_models()
build_sidecar()
install_frontend()
# Build Tauri desktop app
step("Building Tauri Desktop App", "Compiling Rust + bundling DMG/EXE...")
if shutil.which("cargo"):
try:
build_cmd = "tauri:build:mac" if IS_MACOS else ("tauri:build:win" if IS_WINDOWS else "tauri:build")
run(["npm", "run", build_cmd], capture_output=False, cwd=str(APP_DIR), check=True)
ok("Tauri desktop app built successfully")
bundle_dir = APP_DIR / "src-tauri" / "target" / "release" / "bundle"
if bundle_dir.exists():
print(f"\n {BOLD('Output:')}")
for ext in ("*.dmg", "*.exe", "*.deb", "*.AppImage"):
for f in bundle_dir.rglob(ext):
size_mb = f.stat().st_size / (1024 * 1024)
print(f" {GREEN('>')} {f.name} ({size_mb:.0f} MB)")
except Exception as e:
warn(f"Tauri build failed: {e}")
warn("Ensure Rust is installed: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh")
else:
warn("Rust/Cargo not found. Install via: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh")
complete_banner()
return
# Full install
global TOTAL_STEPS
if args.no_build:
TOTAL_STEPS -= 1
check_system()
setup_venv()
install_deps()
verify_models()
verify_pipeline()
if not args.no_build:
build_sidecar()
install_frontend()
create_launchers()
complete_banner()
if __name__ == "__main__":
main()