-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.bat
More file actions
113 lines (100 loc) · 4.58 KB
/
install.bat
File metadata and controls
113 lines (100 loc) · 4.58 KB
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
@echo off
echo " ___ _ _____ _____ _ _ _ ";
echo " / _ \ | | | ___| |_ _| | | | || | ";
echo "/ /_\ \ _ _ | |_ ___ | |__ __ __ _ __ _ __ ___ ___ ___ | | _ __ ___ | |_ __ _ | || | ___ _ __ ";
echo "| _ || | | || __|/ _ \ | __|\ \/ /| '_ \ | '__|/ _ \/ __|/ __| | | | '_ \ / __|| __|/ _\`|| || | / _ \| '__|";
echo "| | | || |_| || |_| (_) || |___ > < | |_) || | | __/\__ \\__ \ _| |_| | | |\__ \| |_| (_| || || || __/| | ";
echo "\_| |_/ \__,_| \__|\___/ \____//_/\_\| .__/ |_| \___||___/|___/ \___/|_| |_||___/ \__|\__,_||_||_| \___||_| ";
echo " | | ";
echo " |_| ";
echo ================================================
:: Define log file
set LOGFILE=install_logs.txt
:: Clear the log file at the start
echo ================================================== > %LOGFILE%
echo Installation Log - %date% %time% >> %LOGFILE%
echo ================================================== >> %LOGFILE%
:: Check if Python is installed
echo Checking if Python is installed...
echo [INFO] Checking if Python is installed... >> %LOGFILE%
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Python is not installed or not added to PATH. >> %LOGFILE%
echo [ERROR] Python is not installed or not added to PATH.
exit /b 1
)
echo [SUCCESS] Python found.
echo [SUCCESS] Python found. >> %LOGFILE%
:: Check if .venv folder exists and delete it
if exist ".venv" (
echo Virtual environment detected. Deleting existing environment...
echo [INFO] Virtual environment detected. Deleting existing environment... >> %LOGFILE%
rmdir /s /q ".venv" >> %LOGFILE% 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Failed to delete the existing virtual environment. >> %LOGFILE%
echo [ERROR] Failed to delete the existing virtual environment.
exit /b 1
)
echo [SUCCESS] Existing virtual environment deleted.
echo [SUCCESS] Existing virtual environment deleted. >> %LOGFILE%
)
:: Create a new virtual environment
echo Creating new virtual environment...
echo [INFO] Creating new virtual environment... >> %LOGFILE%
python -m venv .venv >> %LOGFILE% 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Failed to create the virtual environment. >> %LOGFILE%
echo [ERROR] Failed to create the virtual environment.
exit /b 1
)
echo [SUCCESS] Virtual environment created successfully.
echo [SUCCESS] Virtual environment created successfully. >> %LOGFILE%
:: Activate the virtual environment
echo Activating virtual environment...
echo [INFO] Activating virtual environment... >> %LOGFILE%
call .venv\Scripts\activate >> %LOGFILE% 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Failed to activate the virtual environment. >> %LOGFILE%
echo [ERROR] Failed to activate the virtual environment.
exit /b 1
)
:: Upgrade pip to the latest version
echo Upgrading pip to the latest version...
echo [INFO] Upgrading pip... >> %LOGFILE%
python.exe -m pip install --upgrade pip >> %LOGFILE% 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Failed to upgrade pip. >> %LOGFILE%
echo [ERROR] Failed to upgrade pip.
deactivate
exit /b 1
)
echo [SUCCESS] Pip upgraded successfully.
echo [SUCCESS] Pip upgraded successfully. >> %LOGFILE%
:: Check if requirements.txt exists
if not exist requirements.txt (
echo [ERROR] requirements.txt not found. >> %LOGFILE%
echo [ERROR] requirements.txt not found.
deactivate
exit /b 1
)
:: Install requirements
echo Installing requirements from requirements.txt...
echo [INFO] Installing requirements from requirements.txt... >> %LOGFILE%
pip install -r requirements.txt >> %LOGFILE% 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Failed to install requirements. >> %LOGFILE%
echo [ERROR] Failed to install requirements.
deactivate
exit /b 1
)
echo [SUCCESS] Requirements installed successfully.
echo [SUCCESS] Requirements installed successfully. >> %LOGFILE%
:: Deactivate the virtual environment
echo Deactivating virtual environment...
echo [INFO] Deactivating virtual environment... >> %LOGFILE%
call deactivate >> %LOGFILE% 2>&1
echo ================================================== >> %LOGFILE%
echo All requirements installed successfully. >> %LOGFILE%
echo All requirements installed successfully.
echo ==================================================
pause