assile commited on
Commit
7219fe7
·
verified ·
1 Parent(s): 5e535ef

Delete installer

Browse files
installer/installer.py DELETED
@@ -1,87 +0,0 @@
1
- import argparse
2
- import glob
3
- import os
4
- import shutil
5
- import site
6
- import subprocess
7
- import sys
8
-
9
-
10
- script_dir = os.getcwd()
11
-
12
-
13
- def run_cmd(cmd, capture_output=False, env=None):
14
- # Run shell commands
15
- return subprocess.run(cmd, shell=True, capture_output=capture_output, env=env)
16
-
17
-
18
- def check_env():
19
- # If we have access to conda, we are probably in an environment
20
- conda_not_exist = run_cmd("conda", capture_output=True).returncode
21
- if conda_not_exist:
22
- print("Conda is not installed. Exiting...")
23
- sys.exit()
24
-
25
- # Ensure this is a new environment and not the base environment
26
- if os.environ["CONDA_DEFAULT_ENV"] == "base":
27
- print("Create an environment for this project and activate it. Exiting...")
28
- sys.exit()
29
-
30
-
31
- def install_dependencies():
32
- global MY_PATH
33
-
34
- # Install Git and clone repo
35
- run_cmd("conda install -y -k git")
36
- run_cmd("git clone https://github.com/C0untFloyd/roop-unleashed.git")
37
- os.chdir(MY_PATH)
38
- run_cmd("git checkout 5bfafdc97a0c47b46ec83e6530a57399aaad75d7")
39
- # Installs dependencies from requirements.txt
40
- run_cmd("python -m pip install -r requirements.txt")
41
-
42
-
43
-
44
- def update_dependencies():
45
- global MY_PATH
46
-
47
- os.chdir(MY_PATH)
48
- # do a hard reset for to update even if there are local changes
49
- run_cmd("git fetch --all")
50
- run_cmd("git reset --hard origin/main")
51
- run_cmd("git pull")
52
- # Installs/Updates dependencies from all requirements.txt
53
- run_cmd("python -m pip install -r requirements.txt")
54
-
55
-
56
- def start_app():
57
- global MY_PATH
58
-
59
- os.chdir(MY_PATH)
60
- # forward commandline arguments
61
- sys.argv.pop(0)
62
- args = ' '.join(sys.argv)
63
- print("Launching App")
64
- run_cmd(f'python run.py {args}')
65
-
66
-
67
- if __name__ == "__main__":
68
- global MY_PATH
69
-
70
- MY_PATH = "roop-unleashed"
71
-
72
-
73
- # Verifies we are in a conda environment
74
- check_env()
75
-
76
- # If webui has already been installed, skip and run
77
- if not os.path.exists(MY_PATH):
78
- install_dependencies()
79
- else:
80
- # moved update from batch to here, because of batch limitations
81
- updatechoice = input("Check for Updates? [y/n]").lower()
82
- if updatechoice == "y":
83
- update_dependencies()
84
-
85
- # Run the model with webui
86
- os.chdir(script_dir)
87
- start_app()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
installer/macOSinstaller.sh DELETED
@@ -1,73 +0,0 @@
1
- #!/bin/bash
2
-
3
- # This script checks and installs all dependencies which are needed to run roop-unleashed. After that, it clones the repo.
4
- # Execute this easily with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/PJF16/roop-unleashed/master/installer/macOSinstaller.sh)
5
-
6
- # Function to check if a command exists
7
- command_exists() {
8
- command -v "$1" >/dev/null 2>&1
9
- }
10
-
11
- echo "Starting check and installation process of dependencies for roop-unleashed"
12
-
13
- # Check if Homebrew is installed
14
- if ! command_exists brew; then
15
- echo "Homebrew is not installed. Starting installation..."
16
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
17
- else
18
- echo "Homebrew is already installed."
19
- fi
20
-
21
- # Update Homebrew
22
- echo "Updating Homebrew..."
23
- brew update
24
-
25
- # Check if Python 3.11 is installed
26
- if brew list --versions [email protected] >/dev/null; then
27
- echo "Python 3.11 is already installed."
28
- else
29
- echo "Python 3.11 is not installed. Installing it now..."
30
- brew install [email protected]
31
- fi
32
-
33
- # Check if [email protected] is installed
34
- if brew list --versions [email protected] >/dev/null; then
35
- echo "[email protected] is already installed."
36
- else
37
- echo "[email protected] is not installed. Installing it now..."
38
- brew install [email protected]
39
- fi
40
-
41
- # Check if ffmpeg is installed
42
- if command_exists ffmpeg; then
43
- echo "ffmpeg is already installed."
44
- else
45
- echo "ffmpeg is not installed. Installing it now..."
46
- brew install ffmpeg
47
- fi
48
-
49
- # Check if git is installed
50
- if command_exists git; then
51
- echo "git is already installed."
52
- else
53
- echo "git is not installed. Installing it now..."
54
- brew install git
55
- fi
56
-
57
- # Clone the repository
58
- REPO_URL="https://github.com/C0untFloyd/roop-unleashed.git"
59
- REPO_NAME="roop-unleashed"
60
-
61
- echo "Cloning the repository $REPO_URL..."
62
- git clone $REPO_URL
63
-
64
- # Check if the repository was cloned successfully
65
- if [ -d "$REPO_NAME" ]; then
66
- echo "Repository cloned successfully. Changing into directory $REPO_NAME..."
67
- cd "$REPO_NAME"
68
- else
69
- echo "Failed to clone the repository."
70
- fi
71
-
72
- echo "Check and installation process completed."
73
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
installer/windows_run.bat DELETED
@@ -1,95 +0,0 @@
1
- @echo off
2
-
3
- REM No CLI arguments supported anymore
4
- set COMMANDLINE_ARGS=
5
-
6
- cd /D "%~dp0"
7
-
8
- echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. && goto end
9
-
10
- set PATH=%PATH%;%SystemRoot%\system32
11
-
12
- @rem config
13
- set INSTALL_DIR=%cd%\installer_files
14
- set CONDA_ROOT_PREFIX=%cd%\installer_files\conda
15
- set INSTALL_ENV_DIR=%cd%\installer_files\env
16
- set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
17
- set FFMPEG_DOWNLOAD_URL=https://github.com/GyanD/codexffmpeg/releases/download/7.1/ffmpeg-7.1-essentials_build.zip
18
- set INSTALL_FFMPEG_DIR=%cd%\installer_files\ffmpeg
19
- set INSIGHTFACE_PACKAGE_URL=https://github.com/C0untFloyd/roop-unleashed/releases/download/3.6.6/insightface-0.7.3-cp310-cp310-win_amd64.whl
20
- set INSIGHTFACE_PACKAGE_PATH=%INSTALL_DIR%\insightface-0.7.3-cp310-cp310-win_amd64.whl
21
-
22
- set conda_exists=F
23
- set ffmpeg_exists=F
24
-
25
- @rem figure out whether git and conda needs to be installed
26
- call "%CONDA_ROOT_PREFIX%\_conda.exe" --version >nul 2>&1
27
- if "%ERRORLEVEL%" EQU "0" set conda_exists=T
28
-
29
- @rem Check if FFmpeg is already in PATH
30
- where ffmpeg >nul 2>&1
31
- if "%ERRORLEVEL%" EQU "0" (
32
- echo FFmpeg is already installed.
33
- set ffmpeg_exists=T
34
- )
35
-
36
- @rem (if necessary) install git and conda into a contained environment
37
-
38
- @rem download conda
39
- if "%conda_exists%" == "F" (
40
- echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL% to %INSTALL_DIR%\miniconda_installer.exe
41
- mkdir "%INSTALL_DIR%"
42
- call curl -Lk "%MINICONDA_DOWNLOAD_URL%" > "%INSTALL_DIR%\miniconda_installer.exe" || ( echo. && echo Miniconda failed to download. && goto end )
43
- echo Installing Miniconda to %CONDA_ROOT_PREFIX%
44
- start /wait "" "%INSTALL_DIR%\miniconda_installer.exe" /InstallationType=JustMe /NoShortcuts=1 /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%CONDA_ROOT_PREFIX%
45
-
46
- @rem test the conda binary
47
- echo Miniconda version:
48
- call "%CONDA_ROOT_PREFIX%\_conda.exe" --version || ( echo. && echo Miniconda not found. && goto end )
49
- )
50
-
51
- @rem create the installer env
52
- if not exist "%INSTALL_ENV_DIR%" (
53
- echo Creating Conda Environment
54
- call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.10 || ( echo. && echo ERROR: Conda environment creation failed. && goto end )
55
- @rem check if conda environment was actually created
56
- if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo ERROR: Conda environment is empty. && goto end )
57
- @rem activate installer env
58
- call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo ERROR: Miniconda hook not found. && goto end )
59
- @rem Download insightface package
60
- echo Downloading insightface package from %INSIGHTFACE_PACKAGE_URL% to %INSIGHTFACE_PACKAGE_PATH%
61
- call curl -Lk "%INSIGHTFACE_PACKAGE_URL%" > "%INSIGHTFACE_PACKAGE_PATH%" || ( echo. && echo ERROR: Insightface package failed to download. && goto end )
62
- @rem install insightface package using pip
63
- echo Installing insightface package
64
- call pip install "%INSIGHTFACE_PACKAGE_PATH%" || ( echo. && echo ERROR: Insightface package installation failed. && goto end )
65
- )
66
-
67
- @rem Download and install FFmpeg if not already installed
68
- if "%ffmpeg_exists%" == "F" (
69
- if not exist "%INSTALL_FFMPEG_DIR%" (
70
- echo Downloading ffmpeg from %FFMPEG_DOWNLOAD_URL% to %INSTALL_DIR%
71
- call curl -Lk "%FFMPEG_DOWNLOAD_URL%" > "%INSTALL_DIR%\ffmpeg.zip" || ( echo. && echo ffmpeg failed to download. && goto end )
72
- call powershell -command "Expand-Archive -Force '%INSTALL_DIR%\ffmpeg.zip' '%INSTALL_DIR%\'"
73
- cd "%INSTALL_DIR%"
74
- move ffmpeg-* ffmpeg
75
- setx PATH "%INSTALL_FFMPEG_DIR%\bin\;%PATH%"
76
- echo To use videos, you need to restart roop after this installation.
77
- cd ..
78
- )
79
- ) else (
80
- echo Skipping FFmpeg installation as it is already available.
81
- )
82
-
83
- @rem setup installer env
84
- @rem check if conda environment was actually created
85
- if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo ERROR: Conda environment is empty. && goto end )
86
- @rem activate installer env
87
- call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo ERROR: Miniconda hook not found. && goto end )
88
- echo Launching roop unleashed
89
- call python installer.py %COMMANDLINE_ARGS%
90
-
91
- echo.
92
- echo Done!
93
-
94
- :end
95
- pause