forked from Transport-for-the-North/NorMITs-Demand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconda_install.bat
49 lines (42 loc) · 1.48 KB
/
conda_install.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
@echo off
set anaconda_path=%USERPROFILE%\Anaconda3
set miniconda_path=%USERPROFILE%\Miniconda3
set anaconda_activate=%anaconda_path%\Scripts\activate.bat
set miniconda_activate=%miniconda_path%\Scripts\activate.bat
set env_name=NorMITs-Demand
set env_file=requirements.txt
REM Check if conda is already in PATH
WHERE conda
IF errorlevel 0 (
goto create_env
)
REM Activate conda from default Miniconda or Anaconda folder if it isn't in PATH
IF EXIST %anaconda_activate% (
set env_path=%anaconda_path%\envs\%env_name%
set activate=%anaconda_activate%
) ELSE (
IF EXIST %miniconda_activate% (
set env_path=%miniconda_path%\envs\%env_name%
set activate=%miniconda_activate%
) ELSE (
echo Please ensure Anaconda3 is installed to %USERPROFILE%\Anaconda3
echo or Miniconda3 is installed to %USERPROFILE%\Miniconda3.
echo Anaconda: https://www.anaconda.com/products/individual
echo Miniconda: https://docs.conda.io/en/latest/miniconda.html
echo If the filepath is different, please add conda folder to PATH.
goto end
)
)
call %activate%
:create_env
REM Create environment, overwriting if one already exists
echo Creating %env_name%
call conda env list | find /i "%env_name%"
IF not errorlevel 1 (
echo Found existing copy of %env_name%, removing
call conda env remove -n %env_name%
)
call conda create -n %env_name% --file %env_file% -c conda-forge -y
echo %env_name% created, you may exit this installer.
:end
pause