Create separate venv for running notebooks

This commit is contained in:
Niels Geens
2025-04-29 16:17:46 +02:00
parent 36d718d326
commit 2179bbe00d
2 changed files with 45 additions and 18 deletions

View File

@@ -1,5 +1,15 @@
#!/bin/bash
#SIA_INSTALL_NO_ITB=1
#SIA_INSTALL_NO_TRAIN=1
#SIA_INSTALL_NO_NOTEBOOK=1
#SIA_INSTALL_NO_CORE=1
#SIA_BOOTSTRAP_NO_CHROME=1
#SIA_BOOTSTRAP_NO_RUST=1
#SIA_BOOTSTRAP_NO_WEB=1
#SIA_BOOTSTRAP_NO_TRAIN=1
#SIA_BOOTSTRAP_NO_START=1
trap 'return 1' ERR
# Check if required environment variables are set
@@ -31,18 +41,22 @@ apt-get install -y \
;
# Install Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
apt-get update && \
apt-get install -y \
google-chrome-stable
if [ -z "${SIA_BOOTSTRAP_NO_CHROME}" ]; then
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
apt-get update && \
apt-get install -y \
google-chrome-stable
fi
# Install Rust
curl https://sh.rustup.rs -sSf | bash -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
if [ -z "${SIA_BOOTSTRAP_NO_RUST}" ]; then
curl https://sh.rustup.rs -sSf | bash -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
fi
# Install Node.js
if ! command -v node &> /dev/null; then
if [ -z "${SIA_BOOTSTRAP_NO_WEB}" ]; then
echo "Installing Node.js..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="/root/.nvm"
@@ -69,11 +83,13 @@ if [ ! -d "/root/sia" ]; then
fi
# Build web interface
echo "Building web interface"
cd "/root/sia/web"
npm install
npm run build
ln -s "/root/sia/web/dist" "/root/static"
if [ -z "${SIA_BOOTSTRAP_NO_WEB}" ]; then
echo "Building web interface"
cd "/root/sia/web"
npm install
npm run build
ln -s "/root/sia/web/dist" "/root/static"
fi
# Install SIA dependencies
cd /root/desktop
@@ -93,10 +109,14 @@ fi
source /root/sia/scripts/add_venvs_to_path.sh
# Finetune model
echo "Finetuning model..."
train /root/models/bootstrap
ln -s /root/models/bootstrap /root/models/current
if [ -z "${SIA_BOOTSTRAP_NO_TRAIN}" ]; then
echo "Finetuning model..."
train /root/models/bootstrap
ln -s /root/models/bootstrap /root/models/current
fi
# Start SIA using restart script
echo "Run restart script..."
"/root/sia/scripts/restart.sh"
if [ -z "${SIA_BOOTSTRAP_NO_START}" ]; then
echo "Run restart script..."
"/root/sia/scripts/restart.sh"
if [ -z "${SIA_BOOTSTRAP_NO_TRAIN}" ]; then

View File

@@ -13,6 +13,13 @@ if [ -z "${SIA_INSTALL_NO_TRAIN}" ]; then
/root/venvs/train/bin/ipython kernel install --name=train
fi
if [ -z "${SIA_INSTALL_NO_NOTEBOOK}"]; then
echo "Installing venv for running notebooks..."
python3 -m venv /root/venvs/notebook
/root/venvs/notebook/bin/pip install ipykernel ipywidgets
/root/venvs/notebook/bin/ipython kernel install --name=notebook
fi
if [ -z "${SIA_INSTALL_NO_CORE}" ]; then
echo "Installing SIA core..."
python3 -m venv /root/venvs/sia