From ed37792b629efe89e240112f05fd77d70b7c4862 Mon Sep 17 00:00:00 2001 From: Niels Geens Date: Wed, 2 Apr 2025 15:58:30 +0000 Subject: [PATCH] Better path fix --- scripts/add_venvs_to_path.sh | 6 ++++++ scripts/bootstrap.sh | 14 ++++++++++++-- scripts/install.sh | 8 +------- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 scripts/add_venvs_to_path.sh diff --git a/scripts/add_venvs_to_path.sh b/scripts/add_venvs_to_path.sh new file mode 100644 index 0000000..0a9b1ea --- /dev/null +++ b/scripts/add_venvs_to_path.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +for venv in /root/venvs/*/bin +do + export PATH=$PATH:$venv +done \ No newline at end of file diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 03ae45e..0dea136 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -58,8 +58,18 @@ ln -s "/root/sia/web/dist" "/root/static" # Install SIA dependencies source "/root/sia/scripts/install.sh" -# Fix runpod environment so it doesn't reset PATH -sed -i '/^export PATH/d' /etc/rp_environment +# Add venvs to path in .bashrc +if ! grep -q "source /root/sia/scripts/add_venvs_to_path.sh" /root/.bashrc; then + echo 'source /root/sia/scripts/add_venvs_to_path.sh' >> /root/.bashrc +fi + +# Add venvs to path in profile +if ! grep -q "source /root/sia/scripts/add_venvs_to_path.sh" /etc/profile; then + echo 'source /root/sia/scripts/add_venvs_to_path.sh' >> /etc/profile +fi + +# Add venvs to path in current shell +source /root/sia/scripts/add_venvs_to_path.sh ## Finetune model #echo "Finetuning model..." diff --git a/scripts/install.sh b/scripts/install.sh index 90288aa..e5529ee 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -4,19 +4,13 @@ echo "Installing ITB tool..." python3 -m venv /root/venvs/itb /root/venvs/itb/bin/pip install -e /root/sia/tools/itb /root/venvs/train/bin/ipython kernel install --name=itb -echo "PATH=\$PATH:/root/venvs/itb/bin" > /etc/profile.d/itb.sh -source /etc/profile.d/itb.sh echo "Installing Train tool..." python3 -m venv /root/venvs/train /root/venvs/train/bin/pip install -e /root/sia/tools/train /root/venvs/train/bin/ipython kernel install --name=train -echo "PATH=\$PATH:/root/venvs/train/bin" > /etc/profile.d/train.sh -source /etc/profile.d/train.sh echo "Installing SIA core..." python3 -m venv /root/venvs/sia /root/venvs/sia/bin/pip install -e /root/sia -/root/venvs/train/bin/ipython kernel install --name=sia -echo "PATH=\$PATH:/root/venvs/sia/bin" > /etc/profile.d/sia.sh -source /etc/profile.d/sia.sh +/root/venvs/train/bin/ipython kernel install --name=sia \ No newline at end of file