-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_samantha_ia.bat
211 lines (185 loc) · 5.26 KB
/
install_samantha_ia.bat
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
@echo off
setlocal
:: Initialize
:inicio
cls
echo.
echo Welcome!
echo.
echo Do you want to install Samantha Interface Assistant?
echo.
echo 1. Yes
echo 2. No
echo.
set /p opcao="Select your option (1 or 2): "
:: Input Validation
if "%opcao%"=="1" (
goto continuar
) else if "%opcao%"=="2" (
echo.
echo Closing the program...
echo.
pause
exit
) else (
echo.
echo Invalid option! Please enter 1 or 2.
echo.
pause
goto inicio
)
:: Installation Steps
:continuar
echo.
echo Wise decision! Continuing the installation...
echo.
pause
:: Enable UTF-8
@echo.
chcp 65001
@echo.
:: Section: Miniconda Installation
@echo =========================
@echo GETTING CURRENT DIRECTORY
@echo =========================
@echo.
@echo Getting current directory...
set CURRENT_DIR=%cd%
@echo Current directory: %CURRENT_DIR%
:::: Check if Miniconda directory already exists
::if exist "%CURRENT_DIR%\miniconda3" (
:: echo.
:: echo The folder 'miniconda3' already exists. Exiting installation routine...
:: pause
:: exit
::)
:: Check if Miniconda directory already exists
if exist "%CURRENT_DIR%\miniconda3" (
echo.
echo The folder 'miniconda3' already exists.
echo Removing existing installation...
rmdir /s /q "%CURRENT_DIR%\miniconda3"
echo Old installation removed. Continuing with new installation...
)
@echo.
@echo ====================
@echo INSTALLING MINICONDA
@echo ====================
@echo.
@echo Creating folder for Miniconda...
mkdir miniconda3
@echo.
:: Download the Miniconda installer with integrity check
@echo Downloading Miniconda...
set MINICONDA_URL=https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe
curl -L -O %MINICONDA_URL%
if not exist Miniconda3-latest-Windows-x86_64.exe (
echo.
echo Error: Download failed. Exiting.
pause
exit /b 1
)
@echo.
@echo Verifying file integrity...
certutil -hashfile Miniconda3-latest-Windows-x86_64.exe SHA256
:: Add checksum verification here if the expected hash is known, for example:
:: set expected_hash=your_expected_hash_here
:: if not "%hash%"=="%expected_hash%" (
:: echo.
:: echo Hash verification failed. Exiting.
:: exit /b 1
:: )
@echo.
@echo Installing Miniconda in %CURRENT_DIR%\miniconda3...
start /WAIT "" Miniconda3-latest-Windows-x86_64.exe /InstallationType=JustMe /RegisterPython=0 /S /D=%CURRENT_DIR%\miniconda3
if errorlevel 1 (
echo.
echo Installation failed. Exiting.
pause
exit /b 1
)
:: Clean up installer
@echo Removing installer file...
DEL Miniconda3-latest-Windows-x86_64.exe
@echo Miniconda installation completed successfully!
@echo.
:: Section: Environment Setup
@echo =======================================
@echo CREATING VIRTUAL ENVIRONMENT 'samantha'
@echo =======================================
@echo.
:: Create the 'samantha' environment with Python 3.10
@echo Creating virtual environment 'samantha'...
call %CURRENT_DIR%\miniconda3\condabin\conda.bat create -y --prefix %CURRENT_DIR%\miniconda3\envs\samantha python=3.10
if errorlevel 1 (
echo.
echo Failed to create 'samantha' environment. Exiting.
pause
exit /b 1
)
@echo Activating 'samantha' environment...
call %CURRENT_DIR%\miniconda3\condabin\conda.bat activate %CURRENT_DIR%\miniconda3\envs\samantha
if errorlevel 1 (
echo.
echo Failed to activate 'samantha' environment. Exiting.
pause
exit /b 1
)
::@echo Installing C++ compilers in the environment...
::call %CURRENT_DIR%\miniconda3\condabin\conda.bat install -y -c conda-forge compilers
::if errorlevel 1 (
:: echo.
:: echo Failed to install C++ compilers. Exiting.
:: pause
:: exit /b 1
::)
::@echo Installing additional Windows toolchain...
::call %CURRENT_DIR%\miniconda3\condabin\conda.bat install -y -c conda-forge m2w64-toolchain libpython
::if errorlevel 1 (
:: echo.
:: echo Failed to install Windows toolchain. Exiting.
:: pause
:: exit /b 1
::)
@echo Installing dependencies for 'samantha'...
call pip install -r requirements_samantha.txt
if errorlevel 1 (
echo.
echo Failed to install dependencies. Exiting.
pause
exit /b 1
)
@echo.
@echo =========================================
@echo CREATING VIRTUAL ENVIRONMENT 'jupyterlab'
@echo =========================================
@echo.
:: Create the 'jupyterlab' environment with Python 3.10
@echo Creating virtual environment 'jupyterlab'...
call %CURRENT_DIR%\miniconda3\condabin\conda.bat create -y --prefix %CURRENT_DIR%\miniconda3\envs\jupyterlab python=3.10
if errorlevel 1 (
echo.
echo Failed to create 'jupyterlab' environment. Exiting.
pause
exit /b 1
)
@echo Activating 'jupyterlab' environment...
call %CURRENT_DIR%\miniconda3\condabin\conda.bat activate %CURRENT_DIR%\miniconda3\envs\jupyterlab
if errorlevel 1 (
echo.
echo Failed to activate 'jupyterlab' environment. Exiting.
pause
exit /b 1
)
@echo Installing dependencies for 'jupyterlab'...
call pip install -r requirements_jupyterlab.txt
if errorlevel 1 (
echo.
echo Failed to install dependencies. Exiting.
pause
exit /b 1
)
@echo.
@echo All tasks completed successfully!
pause
exit