Spaces:
Runtime error
Runtime error
File size: 3,320 Bytes
08ff08a |
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 |
@echo off
setlocal enabledelayedexpansion
title Applio Installer
echo Welcome to the Applio Installer!
echo.
set "INSTALL_DIR=%cd%"
set "MINICONDA_DIR=%UserProfile%\Miniconda3"
set "ENV_DIR=%INSTALL_DIR%\env"
set "MINICONDA_URL=https://repo.anaconda.com/miniconda/Miniconda3-py310_24.7.1-0-Windows-x86_64.exe"
set "CONDA_EXE=%MINICONDA_DIR%\Scripts\conda.exe"
set "startTime=%TIME%"
set "startHour=%TIME:~0,2%"
set "startMin=%TIME:~3,2%"
set "startSec=%TIME:~6,2%"
set /a startHour=1%startHour% - 100
set /a startMin=1%startMin% - 100
set /a startSec=1%startSec% - 100
set /a startTotal = startHour*3600 + startMin*60 + startSec
call :cleanup
call :install_miniconda
call :create_conda_env
call :install_dependencies
set "endTime=%TIME%"
set "endHour=%TIME:~0,2%"
set "endMin=%TIME:~3,2%"
set "endSec=%TIME:~6,2%"
set /a endHour=1%endHour% - 100
set /a endMin=1%endMin% - 100
set /a endSec=1%endSec% - 100
set /a endTotal = endHour*3600 + endMin*60 + endSec
set /a elapsed = endTotal - startTotal
if %elapsed% lss 0 set /a elapsed += 86400
set /a hours = elapsed / 3600
set /a minutes = (elapsed %% 3600) / 60
set /a seconds = elapsed %% 60
echo Installation time: %hours% hours, %minutes% minutes, %seconds% seconds.
echo.
echo Applio has been installed successfully!
echo To start Applio, please run 'run-applio.bat'.
echo.
pause
exit /b 0
:cleanup
echo Cleaning up unnecessary files...
for %%F in (Makefile Dockerfile docker-compose.yaml *.sh) do if exist "%%F" del "%%F"
echo Cleanup complete.
echo.
exit /b 0
:install_miniconda
if exist "%CONDA_EXE%" (
echo Miniconda already installed. Skipping installation.
exit /b 0
)
echo Miniconda not found. Starting download and installation...
powershell -Command "& {Invoke-WebRequest -Uri '%MINICONDA_URL%' -OutFile 'miniconda.exe'}"
if not exist "miniconda.exe" goto :download_error
start /wait "" miniconda.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%MINICONDA_DIR%
if errorlevel 1 goto :install_error
del miniconda.exe
echo Miniconda installation complete.
echo.
exit /b 0
:create_conda_env
echo Creating Conda environment...
call "%MINICONDA_DIR%\_conda.exe" create --no-shortcuts -y -k --prefix "%ENV_DIR%" python=3.10
if errorlevel 1 goto :error
echo Conda environment created successfully.
echo.
if exist "%ENV_DIR%\python.exe" (
echo Installing uv package installer...
"%ENV_DIR%\python.exe" -m pip install uv
if errorlevel 1 goto :error
echo uv installation complete.
echo.
)
exit /b 0
:install_dependencies
echo Installing dependencies...
call "%MINICONDA_DIR%\condabin\conda.bat" activate "%ENV_DIR%" || goto :error
uv pip install --upgrade setuptools || goto :error
uv pip install -r "%INSTALL_DIR%\requirements.txt" || goto :error
uv pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --upgrade --index-url https://download.pytorch.org/whl/cu121 || goto :error
uv pip install numpy==1.26.4 || goto :error
call "%MINICONDA_DIR%\condabin\conda.bat" deactivate
echo Dependencies installation complete.
echo.
exit /b 0
:download_error
echo Download failed. Please check your internet connection and try again.
goto :error
:install_error
echo Miniconda installation failed.
goto :error
:error
echo An error occurred during installation. Please check the output above for details.
pause
exit /b 1 |