Build the executable on a Windows machine. PyInstaller does not cross-compile a Windows .exe reliably from Linux.
From the project root in PowerShell:
.\scripts\build_windows.ps1 -CleanIf uv is not installed, the script installs it automatically using Astral's official Windows installer, then continues the build.
Before building, confirm the spec file exists in the project root:
Test-Path .\gym_vision.specThis must print:
True
This runs:
uv run --with pyinstaller pyinstaller --clean --noconfirm .\gym_vision.spec
uv run --with pyinstaller pyinstaller --clean --noconfirm .\test_ws_server_gui.specOutput:
dist\gym_vision.exe
dist\test_ws_server_gui.exe
dist\config.yaml
facegate-windows.zip
config.yaml is intentionally kept outside the one-file executable.
Keep this layout:
dist\
gym_vision.exe
test_ws_server_gui.exe
config.yaml
The build script also creates a release-style archive:
facegate-windows.zip
Edit dist\config.yaml to change cameras, websocket URL, database path, FPS limits, crop settings, and recognition thresholds. You do not need to rebuild the .exe after editing the config.
Run:
.\dist\gym_vision.exeRun the GUI test server:
.\dist\test_ws_server_gui.exeOr use an explicit config path:
.\dist\gym_vision.exe --config-path C:\Latika\config.yamlThe models\ directory is bundled into the one-file executable. The default config value:
vision_setting:
models_path: models/will use external models\ if it exists near the config/current directory, otherwise it falls back to the bundled PyInstaller model files.
Relative database paths are resolved relative to the config file location. With the default:
vision_setting:
face_DB_path: data/face_embeddings.sqlite3the executable will use:
dist\data\face_embeddings.sqlite3
The data directory is generated outside the one-file executable at runtime:
dist\
gym_vision.exe
test_ws_server_gui.exe
config.yaml
data\
face_embeddings.sqlite3
logs\
debug_YYYY-MM-DD.log
error_YYYY-MM-DD.log
This keeps logs and the SQLite database editable, backup-friendly, and persistent across executable rebuilds.