File size: 2,966 Bytes
099b762
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@echo off

rem onwx' (onwx-dash) - LLMs on AMD Ryzen AI with a Radeon GPU: GPU + NPU. Installs the engine and the resident tray app (Windows).

rem Finds Python 3.10+ (offers to install it with winget), creates .venv, installs onwx-dash + the tray, adds "onwx-dash"

rem to the Start menu and starts it in the task tray. Models are downloaded later from the window (Models tab).

rem   ONWX_HALO_NO_SHORTCUT=1   no Start-menu entry        ONWX_HALO_NO_START=1   do not start the tray at the end

rem (a test install: both, plus ONWX_CONFIG_DIR for the settings folder)
setlocal
cd /d "%~dp0"
set PYTHONUTF8=1

if not exist ".venv\Scripts\python.exe" goto create

rem pip ran for this pyproject.toml already (onwx.deps): nothing to install. Otherwise - new packages from an update,

rem an update whose pip could not finish, an older install - pip runs again.
".venv\Scripts\python.exe" -m onwx.deps check >nul 2>&1 && goto shortcut
goto install
:create
call "%~dp0find_python.bat"
if not defined PY (
    pause
    exit /b 1
)
echo [setup] creating Python environment in .venv ...
%PY% -m venv .venv
if errorlevel 1 (
    echo [setup] could not create the Python environment.
    pause
    exit /b 1
)
:install

rem a running onwx keeps its packages' DLLs locked: stopped first (it starts again at the end)
".venv\Scripts\python.exe" -m onwx.deps stop

rem [sec 2026-10] pip >= 26.2.2 first (it downloads with its own certifi; the emSign roots are out after the eMudhra CA

rem compromise). 26.2.1 failed on packages with scripts; 26.2.2 is tested. Not fatal.
".venv\Scripts\python.exe" -m pip install "pip>=26.2.2"
".venv\Scripts\python.exe" -m pip install -e .[tray]
if not errorlevel 1 goto installed
if defined RETRIED (
    echo [setup] package installation failed.
    pause
    exit /b 1
)
echo [setup] installation failed; rebuilding the Python environment once ...
set RETRIED=1
rmdir /s /q .venv
if not defined PY call "%~dp0find_python.bat"

%PY% -m venv .venv
goto install
:installed
".venv\Scripts\python.exe" -m onwx.deps done
echo ok> ".venv\installed.txt"

:shortcut

rem Start menu entry: pythonw -m onwx tray (no console window)
set "PYW=%CD%\.venv\Scripts\pythonw.exe"
if "%ONWX_HALO_NO_SHORTCUT%"=="1" goto noshortcut
powershell -NoProfile -Command ^
  "$s = (New-Object -ComObject WScript.Shell).CreateShortcut([Environment]::GetFolderPath('Programs') + '\onwx-dash.lnk');" ^
  "$s.TargetPath = '%PYW%'; $s.Arguments = '-m onwx tray'; $s.WorkingDirectory = '%CD%';" ^
  "$s.Description = 'onwx-dash - LLMs on the AMD Ryzen AI Radeon GPU + NPU'; $s.IconLocation = '%CD%\onwx\web\icon.ico,0'; $s.Save()"
echo [setup] Start menu: onwx-dash
:noshortcut
if "%ONWX_HALO_NO_START%"=="1" (
    echo [setup] done ^(not started: ONWX_HALO_NO_START^)
    exit /b 0
)
echo [start] onwx-dash is starting in the task tray. Pick a model to download in the window that opens.
start "" "%PYW%" -m onwx tray