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