diff --git a/run-install.bat b/run-install.bat index 22e5db6e..3b3a6a2d 100644 --- a/run-install.bat +++ b/run-install.bat @@ -1,78 +1,76 @@ @echo off -setlocal -title Installer +setlocal enabledelayedexpansion +title Applio Installer + +echo Welcome to the Applio Installer! +echo. set "principal=%cd%" -set "URL_EXTRA=https://huggingface.co/IAHispano/applio/resolve/main" set "CONDA_ROOT_PREFIX=%UserProfile%\Miniconda3" set "INSTALL_ENV_DIR=%principal%\env" set "MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-py39_23.9.0-0-Windows-x86_64.exe" set "CONDA_EXECUTABLE=%CONDA_ROOT_PREFIX%\Scripts\conda.exe" -del Makefile -del Dockerfile -del docker-compose.yaml -del /q *.sh - -if not exist "%cd%\env.zip" ( - echo Downloading the fairseq build... - curl -s -LJO %URL_EXTRA%/env.zip -o env.zip -) - -if not exist "%cd%\env.zip" ( - echo Download failed, trying with the powershell method - powershell -Command "& {Invoke-WebRequest -Uri '%URL_EXTRA%/env.zip' -OutFile 'env.zip'}" -) - -if not exist "%cd%\env" ( - echo Extracting the file... - powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory('%cd%\env.zip', '%cd%') }" -) - -if not exist "%cd%\env" ( - echo Extracting failed trying with the tar method... - tar -xf %cd%\env.zip -) - -if exist "%cd%\env" ( - del env.zip -) else ( - echo Theres a problem extracting the file please download the file and extract it manually. - echo https://huggingface.co/IAHispano/applio/resolve/main/env.zip - pause - exit +echo Cleaning up unnecessary files... +for %%F in (Makefile Dockerfile docker-compose.yaml *.sh) do ( + if exist "%%F" del "%%F" ) +echo Cleanup complete. +echo. if not exist "%CONDA_EXECUTABLE%" ( - echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL%... - curl %MINICONDA_DOWNLOAD_URL% -o miniconda.exe - - if not exist "%principal%\miniconda.exe" ( - echo Download failed trying with the powershell method. - powershell -Command "& {Invoke-WebRequest -Uri '%MINICONDA_DOWNLOAD_URL%' -OutFile 'miniconda.exe'}" + echo Miniconda not found. Starting download and installation... + echo Downloading Miniconda... + powershell -Command "& {Invoke-WebRequest -Uri '%MINICONDA_DOWNLOAD_URL%' -OutFile 'miniconda.exe'}" + if not exist "miniconda.exe" ( + echo Download failed. Please check your internet connection and try again. + goto :error ) - echo Installing Miniconda to %CONDA_ROOT_PREFIX%... + echo Installing Miniconda... start /wait "" miniconda.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%CONDA_ROOT_PREFIX% + if errorlevel 1 ( + echo Miniconda installation failed. + goto :error + ) del miniconda.exe + echo Miniconda installation complete. +) else ( + echo Miniconda already installed. Skipping installation. ) +echo. +echo Creating Conda environment... call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.9 +if errorlevel 1 goto :error +echo Conda environment created successfully. +echo. -if exist "%cd%\env\python.exe" ( - echo Installing pip version less than 24.1... - "%cd%\env\python.exe" -m pip install "pip<24.1" +if exist "%INSTALL_ENV_DIR%\python.exe" ( + echo Installing specific pip version... + "%INSTALL_ENV_DIR%\python.exe" -m pip install "pip<24.1" + if errorlevel 1 goto :error + echo Pip installation complete. + echo. ) -echo Installing the dependencies... -call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" -pip install --upgrade setuptools -pip install -r "%principal%\requirements.txt" +echo Installing dependencies... +call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || goto :error +pip install --upgrade setuptools || goto :error +pip install -r "%principal%\requirements.txt" || goto :error pip uninstall torch torchvision torchaudio -y -pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121 +pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu121 || goto :error call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" deactivate +echo Dependencies installation complete. +echo + +echo Applio has been installed successfully! +echo To start Applio, please run 'run-applio.bat'. echo. +pause +exit /b 0 -echo Applio has been installed successfully, run 'run-applio.bat' to start it! +:error +echo An error occurred during installation. Please check the output above for details. pause -cls +exit /b 1 \ No newline at end of file