diff --git a/jupyterlab/run.sh b/jupyterlab/run.sh index 2dd34ace..f5222520 100755 --- a/jupyterlab/run.sh +++ b/jupyterlab/run.sh @@ -1,13 +1,6 @@ #!/usr/bin/env sh INSTALLER="" check_available_installer() { - # check if pipx is installed - echo "Checking for a supported installer" - if command -v pipx > /dev/null 2>&1; then - echo "pipx is installed" - INSTALLER="pipx" - return - fi # check if uv is installed if command -v uv > /dev/null 2>&1; then echo "uv is installed" @@ -32,23 +25,32 @@ if ! command -v jupyter-lab > /dev/null 2>&1; then printf "$${BOLD}Installing jupyterlab!\n" case $INSTALLER in uv) - uv pip install -q jupyterlab \ + uv venv --seed + uv pip install ipykernel jupyterlab + uv run ipython kernel install --user --env VIRTUAL_ENV $(pwd)/.venv --name=aicentre \ && printf "%s\n" "🥳 jupyterlab has been installed" JUPYTERPATH="$HOME/.venv/bin/" ;; - pipx) - pipx install jupyterlab \ - && printf "%s\n" "🥳 jupyterlab has been installed" - JUPYTERPATH="$HOME/.local/bin" - ;; esac else printf "%s\n\n" "🥳 jupyterlab is already installed" fi + +printf "⚠️ setting proxy vars..." +cat $HOME/.local/share/jupyter/kernels/aicentre/kernel.json | jq -r \ + --arg http_proxy "$http_proxy" \ + --arg https_proxy "$https_proxy" \ + '.env += {"http_proxy": $http_proxy, "https_proxy": $https_proxy}' \ + > tmp.json + +printf "➡️ updating kernelspec..." +mv tmp.json $HOME/.local/share/jupyter/kernels/aicentre/kernel.json + printf "👷 Starting jupyterlab in background..." printf "check logs at ${LOG_PATH}" -$JUPYTERPATH/jupyter-lab --no-browser \ + +http_proxy= https_proxy= $JUPYTERPATH/jupyter-lab --no-browser \ "$BASE_URL_FLAG" \ --ServerApp.ip='*' \ --ServerApp.port="${PORT}" \