-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from cemsbv/41-add-install-scripts-for-windows
Add install scripts for windows
- Loading branch information
Showing
12 changed files
with
320 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
@REM Parse input variables | ||
set python_exe=%1 | ||
set python_env_dir=%2 | ||
|
||
@REM Check whether the python.exe exists, otherwise exit without installing. | ||
if not exist %python_exe% ( | ||
echo %python_exe% does not exists, python environment cannot be created from it. | ||
cmd /k | ||
) | ||
|
||
Rem Create dir to install the python env dir (if it doesn't exist) | ||
mkdir %python_env_dir% | ||
cd %python_env_dir% | ||
%python_exe% -m venv %python_env_dir% | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
mkdir sample | ||
curl --output-dir sample -O https://raw.githubusercontent.com/cemsbv/plxcontroller/main/notebooks/Plaxis3D_input_controller.ipynb | ||
curl --output-dir sample -O https://raw.githubusercontent.com/cemsbv/plxcontroller/main/notebooks/Plaxis3D_output_controller.ipynb | ||
curl --output-dir sample -O https://raw.githubusercontent.com/cemsbv/plxcontroller/main/notebooks/image.png | ||
curl --output-dir sample -O https://raw.githubusercontent.com/cemsbv/plxcontroller/main/notebooks/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
set python_installation_dir=C:\cems-python | ||
set python_version=3.9.13 | ||
set plxcontroller_notebook_dir=C:\cems-notebooks\plxcontroller | ||
set kernel_name=plxcontroller-env | ||
|
||
|
||
echo 1. Download and install python | ||
if not defined CEMS_PYTHON_DIR ( | ||
call install_python %python_version% %python_installation_dir% | ||
Rem Set the system environmental variables of the location of the new installation | ||
setx CEMS_PYTHON_DIR %python_installation_dir%\python-%python_version% | ||
Rem Set it also locally so that it can be accessed without reloading cmd. | ||
set CEMS_PYTHON_DIR %python_installation_dir%\python-%python_version% | ||
) else ( | ||
echo Python is not downloaded and installed, because environmental variable CEMS_PYTHON_DIR is defined. | ||
echo %CEMS_PYTHON_DIR%\python.exe will be used as base to create the python virtual environment. | ||
) | ||
|
||
echo 2. Install jupyter lab | ||
call install_jupyterlab %CEMS_PYTHON_DIR%\python.exe | ||
|
||
echo 3. Set-up notebook directory | ||
call setup_notebook_dir %plxcontroller_notebook_dir% | ||
|
||
echo 4. Create python environment | ||
if not exist %plxcontroller_notebook_dir%\.env\Scripts\python.exe ( | ||
call create_python_env %CEMS_PYTHON_DIR%\python.exe %plxcontroller_notebook_dir%\.env | ||
) else ( | ||
echo Python virtual environment at %plxcontroller_notebook_dir%\.env will be used, no new one is created. | ||
) | ||
|
||
echo 5. Register python environment in ipykernel | ||
call register_env_ipykernel %plxcontroller_notebook_dir%\.env "%kernel_name%" | ||
|
||
echo 6. Install plxcontroller | ||
call install_plxcontroller %plxcontroller_notebook_dir%\.env | ||
|
||
echo 7. Download sample notebooks | ||
cd /D %plxcontroller_notebook_dir% | ||
call download_sample_notebooks | ||
|
||
echo Installation finished! | ||
cmd /k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
@REM Parse input variables | ||
set python_exe=%1 | ||
|
||
@REM Check whether the python.exe exists, otherwise exit without installing. | ||
if not exist %python_exe% ( | ||
echo %python_exe% does not exists, jupyterlab cannot be installed. | ||
cmd /k | ||
) | ||
|
||
@REM Install jupyter lab. | ||
%python_exe% -m pip install jupyterlab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
Rem Parse input variables | ||
set python_env_dir=%1 | ||
|
||
Rem Install ipykernel and register virtual environment | ||
call %python_env_dir%\Scripts\activate.bat | ||
python -m pip install --upgrade pip setuptools | ||
pip install plxcontroller | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
Rem Check which python version is available | ||
Rem https://www.python.org/ftp/python/ # | ||
Rem For Windows it should there should be file ending with amd64.exe, e.g.: | ||
Rem https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe | ||
|
||
Rem Parse input variables | ||
set python_version=%1 | ||
Rem recommended: 3.9.13 | ||
echo python_version is %python_version% and no more. | ||
|
||
set python_installation_dir=%2 | ||
Rem C:\cems-python | ||
echo python_installation_dir is %python_installation_dir% and no more. | ||
|
||
Rem Download python | ||
curl https://www.python.org/ftp/python/%python_version%/python-%python_version%-amd64.exe -O | ||
|
||
Rem Install python | ||
mkdir %python_installation_dir%\python-%python_version% | ||
python-%python_version%-amd64.exe TargetDir=%python_installation_dir%\python-%python_version% AppendPath=1 | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
@REM Parse input variables | ||
set python_env_dir=%1 | ||
set kernel_name=%2 | ||
|
||
Rem Install ipykernel and register virtual environment | ||
call %python_env_dir%/Scripts/activate.bat | ||
python -m pip install --upgrade pip setuptools | ||
pip install ipykernel | ||
python -m ipykernel install --name %kernel_name% | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
Rem Parse input variables | ||
set plxcontroller_notebook_dir=%1 | ||
|
||
Rem Create notebook installation dir and add batch file | ||
mkdir %plxcontroller_notebook_dir% | ||
Rem mkdir %plxcontroller_notebook_dir%\sample | ||
|
||
Rem Copy batch files "start_jupyter_lab", "update_plxcontroller", "download_sample_notebooks" | ||
copy start_jupyter_lab.bat %plxcontroller_notebook_dir% | ||
copy update_plxcontroller.bat %plxcontroller_notebook_dir% | ||
copy download_sample_notebooks.bat %plxcontroller_notebook_dir% | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
set current_dir_path=%~dp0 | ||
|
||
if not defined CEMS_PYTHON_DIR ( | ||
echo Environmental variable CEMS_PYTHON_DIR does not exists, jupyterlab cannot be started. | ||
cmd /k | ||
) | ||
|
||
%CEMS_PYTHON_DIR%\python -m jupyter lab --notebook-dir=%current_dir_path% --preferred-dir %current_dir_path% | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
Rem Install ipykernel and register virtual environment | ||
call .env\Scripts\activate.bat | ||
pip install --upgrade --no-cache-dir plxcontroller | ||
|
||
Rem Download sample notebooks | ||
call download_sample_notebooks | ||
|
||
echo. | ||
echo. | ||
echo The following version of the plxcontroller is installed: | ||
echo. | ||
pip show plxcontroller | ||
|
||
Rem Keep the window open | ||
cmd /k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.