Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 2c8bf9f

Browse files
authored
Get full path to jupyter-lab if already installed
If the `jupyter-lab` binary already exists in $PATH, as found by `command -v jupyter-lab`, then we skip installing using `pipx` or `uv`. By skipping the install path, we leave `${JUPYTERPATH}` unset, which then leads to a broken module unless `jupyter-lab` just so happens to be installed at `/jupyter-lab`. Fix this by calculating the full path to the binary, either from the install locations of `pipx`, `uv` or, in the case that it was preinstalled, from the preinstalled location.
1 parent b58ad58 commit 2c8bf9f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

jupyterlab/run.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,22 @@ if ! command -v jupyter-lab > /dev/null 2>&1; then
3434
uv)
3535
uv pip install -q jupyterlab \
3636
&& printf "%s\n" "🥳 jupyterlab has been installed"
37-
JUPYTERPATH="$HOME/.venv/bin/"
37+
JUPYTER="$HOME/.venv/bin/jupyter-lab"
3838
;;
3939
pipx)
4040
pipx install jupyterlab \
4141
&& printf "%s\n" "🥳 jupyterlab has been installed"
42-
JUPYTERPATH="$HOME/.local/bin"
42+
JUPYTER="$HOME/.local/bin/jupyter-lab"
4343
;;
4444
esac
4545
else
4646
printf "%s\n\n" "🥳 jupyterlab is already installed"
47+
JUPYTER=$(command -v jupyter-lab)
4748
fi
4849

4950
printf "👷 Starting jupyterlab in background..."
5051
printf "check logs at ${LOG_PATH}"
51-
$JUPYTERPATH/jupyter-lab --no-browser \
52+
$JUPYTER --no-browser \
5253
"$BASE_URL_FLAG" \
5354
--ServerApp.ip='*' \
5455
--ServerApp.port="${PORT}" \

0 commit comments

Comments
 (0)