Skip to content

Commit

Permalink
feat(#41): add first version of the install scripts for windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Vasconez committed Nov 21, 2023
1 parent 5fc3a75 commit 0003eec
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 0 deletions.
17 changes: 17 additions & 0 deletions install/windows/create_python_env.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off
setlocal enableDelayedExpansion

Rem Parse input variables
set python_env_dir=%1
Rem C:\cems-notebooks\plxcontroller
echo python_env_dir is %python_env_dir% and no more.

Rem Create dir to install the python env dir (if it doesn't exist)
mkdir %python_env_dir%
cd %python_env_dir%
python -m venv %python_env_dir%
call %python_env_dir%/Scripts/activate.bat




24 changes: 24 additions & 0 deletions install/windows/full_installation.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@echo off
setlocal enableDelayedExpansion

Rem 1. Download and install python
call install_python 3.9.13 C:\cems-python

Rem 2. Install jupyter lab
call install_jupyterlab

Rem 3. Set-up notebook directory
call setup_notebook_dir C:\cems-notebooks\plxcontroller

Rem 4. Create python environment
call create_python_env C:\cems-notebooks\plxcontroller\.env

Rem 5. Register python environment in ipykernel
call register_env_ipykernel C:\cems-notebooks\plxcontroller\.env "plxcontroller-env"

Rem 6. Install plxcontroller
call install_plxcontroller C:\cems-notebooks\plxcontroller\.env

Rem 7. Update plxcontroller (so that the sample notebooks are downloaded)
cd C:\cems-notebooks\plxcontroller
call update_plxcontroller
24 changes: 24 additions & 0 deletions install/windows/full_installation_part2.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@echo off
setlocal enableDelayedExpansion

Rem 1. Download and install python
Rem call install_python 3.9.13 C:\cems-python

Rem 2. Install jupyter lab
Rem call install_jupyterlab

Rem 3. Set-up notebook directory
call setup_notebook_dir C:\cems-notebooks\plxcontroller

Rem 4. Create python environment
call create_python_env C:\cems-notebooks\plxcontroller\.env

Rem 5. Register python environment in ipykernel
call register_env_ipykernel C:\cems-notebooks\plxcontroller\.env "plxcontroller-env"

Rem 6. Install plxcontroller
call install_plxcontroller C:\cems-notebooks\plxcontroller\.env

Rem 7. Update plxcontroller (so that the sample notebooks are downloaded)
cd C:\cems-notebooks\plxcontroller
call update_plxcontroller
7 changes: 7 additions & 0 deletions install/windows/install_jupyterlab.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
setlocal enableDelayedExpansion

Rem This script assumes that you have python installed and it will use the default python
Rem installation
pip install jupyterlab

14 changes: 14 additions & 0 deletions install/windows/install_plxcontroller.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo off
setlocal enableDelayedExpansion

Rem This script assumes that you have python installed and it will use the default python
Rem Parse input variables
set python_env_dir=%1
Rem C:\cems-notebooks\plxcontroller\.env
echo python_env_dir is %python_env_dir% and no more.

Rem Install ipykernel and register virtual environment
call %python_env_dir%\Scripts\activate.bat
python -m pip install --upgrade pip setuptools
pip install plxcontroller

26 changes: 26 additions & 0 deletions install/windows/install_python.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@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% PrependPath=1



20 changes: 20 additions & 0 deletions install/windows/register_env_ipykernel.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@echo off
setlocal enableDelayedExpansion

Rem Parse input variables
set python_env_dir=%1
Rem C:\cems-notebooks\plxcontroller\.env
echo python_env_dir is %python_env_dir% and no more.

set kernel_name=%2
Rem "plxcontroller-env"
echo kernel_name is %kernel_name% and no more.

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%



19 changes: 19 additions & 0 deletions install/windows/setup_notebook_dir.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@echo off
setlocal enableDelayedExpansion

Rem Parse input variables
set notebooks_installation_dir=%1
Rem C:\cems-notebooks\plxcontroller
echo notebooks_installation_dir is %notebooks_installation_dir% and no more.

Rem Create notebook installation dir and add batch file
mkdir %notebooks_installation_dir% %notebooks_installation_dir%\sample

Rem Copy sample notebooks (old)
Rem xcopy sample %notebooks_installation_dir%\sample

Rem Copy batch file "start_jupyter_lab"
copy start_jupyter_lab.bat %notebooks_installation_dir%
copy update_plxcontroller.bat %notebooks_installation_dir%


18 changes: 18 additions & 0 deletions install/windows/start_jupyter_lab.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off
setlocal enableDelayedExpansion

set current_dir_path=%~dp0

jupyter lab --notebook-dir=%current_dir_path% --preferred-dir %current_dir_path%

Rem Parse input variables
Rem set notebooks_installation_dir=%1
Rem C:\cems-notebooks\plxcontroller
Rem echo notebooks_installation_dir is %notebooks_installation_dir% and no more.

Rem Create notebook installation dir and add batch file
Rem mkdir %notebooks_installation_dir% %notebooks_installation_dir%\sample




17 changes: 17 additions & 0 deletions install/windows/update_plxcontroller.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off
setlocal enableDelayedExpansion

Rem Install ipykernel and register virtual environment
call .env\Scripts\activate.bat
pip install --upgrade plxcontroller

Rem Download files under the notebooks directory in plxcontroller repo
curl https://raw.githubusercontent.com/cemsbv/plxcontroller/main/notebooks/Plaxis3D_input_controller.ipynb -O
curl https://raw.githubusercontent.com/cemsbv/plxcontroller/main/notebooks/image.png -O
curl https://raw.githubusercontent.com/cemsbv/plxcontroller/main/notebooks/requirements.txt -O

Rem Save the files under the local sample folder
mkdir sample
move Plaxis3D_input_controller.ipynb sample
move image.png sample
move requirements.txt sample

0 comments on commit 0003eec

Please sign in to comment.