Compare commits

..

7 Commits

View File

@ -13,7 +13,7 @@ Available flags:
t, -t, tensorboard, --tensorboard Launch Tensorboard locally to the script (Require installation beforehand). t, -t, tensorboard, --tensorboard Launch Tensorboard locally to the script (Require installation beforehand).
h, -h, help, --help Which display this help message." h, -h, help, --help Which display this help message."
VENV_PATH=./venv VENV_PATH=./.venv
JUPYTER_ROOT_PATH=./jupyter JUPYTER_ROOT_PATH=./jupyter
TENSORBOARD_LOG_DIR=./logs TENSORBOARD_LOG_DIR=./logs
export R_LIBS_SITE=./libs export R_LIBS_SITE=./libs
@ -39,23 +39,22 @@ enable_venv(){
case "$1" in case "$1" in
i|-i|install|--install) i|-i|install|--install)
python -m venv "$VENV_PATH" python -m venv --upgrade-deps "$VENV_PATH"
mkdir -p "$JUPYTER_ROOT_PATH"/{settings,workspace,config,runtime,data} "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/{notebook-extension,extensionmanager-extension,apputils-extension} mkdir -p "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/{notebook-extension,extensionmanager-extension,apputils-extension}
# Setting it to zero doesn't have the expected result, therefore, let's set it to an abnormally large number. # Setting it to zero doesn't have the expected result, therefore, let's set it to an abnormally large number.
echo '{ "maxNumberOutputs": 10000000000 }' > "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/notebook-extension/tracker.jupyterlab-settings echo '{ "maxNumberOutputs": 10000000000 }' > "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/notebook-extension/tracker.jupyterlab-settings
echo '{ "disclaimed": true }' > "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/extensionmanager-extension/plugin.jupyterlab-settings echo '{ "disclaimed": true }' > "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/extensionmanager-extension/plugin.jupyterlab-settings
echo '{ "theme": "JupyterLab Dark" }' > "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/apputils-extension/themes.jupyterlab-settings echo '{ "theme": "JupyterLab Dark" }' > "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/apputils-extension/themes.jupyterlab-settings
echo '{ "fetchNews": "false" }' > "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/apputils-extension/notification.jupyterlab-settings echo '{ "fetchNews": "false" }' > "$JUPYTERLAB_SETTINGS_DIR"/@jupyterlab/apputils-extension/notification.jupyterlab-settings
enable_venv "$2" enable_venv "$2"
python -m pip install --timeout 120 --retries 10000000000 -U pip setuptools pip install --timeout 120 --retries 1000000000000 -r requirements.txt
pip install --timeout 120 --retries 10000000000 -r requirements.txt
;; ;;
k|-k|kernel|--kernel) k|-k|kernel|--kernel)
enable_venv "$2" enable_venv "$2"
mkdir -p "$R_LIBS_SITE" mkdir -pv "$R_LIBS_SITE"
if command -v Rscript >> /dev/null; then if command -v Rscript >> /dev/null; then
Rscript -e 'install.packages("IRkernel",repos="http://cran.r-project.org");library(IRkernel);IRkernel::installspec()' Rscript -e "install.packages('IRkernel','$R_LIBS_SITE','http://cran.r-project.org');library(IRkernel);IRkernel::installspec()"
else else
echo "R isn't installed" echo "R isn't installed"
exit 1 exit 1
@ -74,13 +73,13 @@ case "$1" in
;; ;;
U|-U|uninstall|--uninstall) U|-U|uninstall|--uninstall)
rm -rf "$VENV_PATH" "$JUPYTER_ROOT_PATH" "$R_LIBS_SITE" rm -rf "$VENV_PATH" "$JUPYTER_ROOT_PATH" "$R_LIBS_SITE" .ipynb_checkpoints __pycache__
;; ;;
l|-l|launch|--launch) l|-l|launch|--launch)
enable_venv "$2" enable_venv "$2"
if command -v jupyter >> /dev/null; then if command -v jupyter >> /dev/null; then
exec jupyter lab --ip 0.0.0.0 --ServerApp.iopub_data_rate_limit 1e16 exec jupyter lab --ip 0.0.0.0
else else
echo "Jupyter lab isn't installed" echo "Jupyter lab isn't installed"
exit 1 exit 1