-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
95 lines (80 loc) · 2.52 KB
/
install.bat
File metadata and controls
95 lines (80 loc) · 2.52 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
:: Windows installer script for PyNetDesign
:: This script creates a Conda environment based on the "environment.yml" or "environment-dev.yml" file and installs the package
:: Run: install.bat from cmd
:: D. Anikiev, 2025-04-01
@echo off
set ENV_NAME=pnd
set PACKAGE_NAME=pynetdesign
:: Ask the user which environment to install
echo Choose which environment to install:
echo [1] User environment: %ENV_NAME% (uses environment.yml)
echo [2] Developer environment: %ENV_NAME%-dev (uses environment-dev.yml)
set /p ENV_CHOICE="Enter 1 for user or 2 for developer: "
if "%ENV_CHOICE%"=="1" (
set ENV_YAML=environment.yml
echo You chose to install the user environment.
) else if "%ENV_CHOICE%"=="2" (
set ENV_NAME=%ENV_NAME%-dev
set ENV_YAML=environment-dev.yml
echo You chose to install the developer environment.
) else (
echo Invalid choice. Exiting.
pause
exit /b 1
)
:: Check for Conda Installation
where conda >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo Conda is not installed or not found in the system PATH.
echo Please install Conda and make sure it's added to the system PATH.
pause
exit /b 2
)
:: Check for environment file
if not exist %ENV_YAML% (
echo %ENV_YAML% not found in the current directory
echo Please check and try again.
pause
exit /b 3
)
echo Creating Conda environment %ENV_NAME% from %ENV_YAML%...
call conda env create -f %ENV_YAML%
:: Check if environment creation was successful
if %ERRORLEVEL% equ 0 (
echo Conda environment %ENV_NAME% created successfully.
) else (
echo Failed to create Conda environment %ENV_NAME%. Please check the error messages above.
pause
exit /b 4
)
:: List conda environments
call conda env list
:: Activate environment
echo Activating Conda environment %ENV_NAME%...
call conda activate %ENV_NAME%
:: Check if environment activation was successful
if %ERRORLEVEL% equ 0 (
echo Conda environment %ENV_NAME% activated successfully.
) else (
echo Failed to activate Conda environment %ENV_NAME%. Please check the error messages above.
pause
exit /b 5
)
echo Installing %PACKAGE_NAME%...
call pip install -e .
if %ERRORLEVEL% equ 0 (
echo Successfully installed %PACKAGE_NAME%.
) else (
echo Failed to install %PACKAGE_NAME%. Please check the error messages above.
pause
exit /b 6
)
echo Python version:
call python --version
echo Python path:
:: Pick only first output
for /f "tokens=* usebackq" %%f in (`where python`) do (set "pythonpath=%%f" & goto :next)
:next
echo %pythonpath%
echo Done!
pause