8000 feat(jupyter): switch from pip3 to pipx for Jupyter install (#294) · coder/modules@e11b19d · GitHub
[go: up one dir, main page]

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

Commit e11b19d

Browse files
authored
feat(jupyter): switch from pip3 to pipx for Jupyter install (#294)
1 parent 93c4fb3 commit e11b19d

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

jupyter-notebook/run.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ printf "$${BOLD}Installing jupyter-notebook!\n"
77
# check if jupyter-notebook is installed
88
if ! command -v jupyter-notebook > /dev/null 2>&1; then
99
# install jupyter-notebook
10-
# check if python3 pip is installed
11-
if ! command -v pip3 > /dev/null 2>&1; then
12-
echo "pip3 is not installed"
13-
echo "Please install pip3 in your Dockerfile/VM image before running this script"
10+
# check if pipx is installed
11+
if ! command -v pipx > /dev/null 2>&1; then
12+
echo "pipx is not installed"
13+
echo "Please install pipx in your Dockerfile/VM image before using this module"
1414
exit 1
1515
fi
16-
# install jupyter-notebook
17-
pip3 install --upgrade --no-cache-dir --no-warn-script-location jupyter
16+
# install jupyter notebook
17+
pipx install -q notebook
1818
echo "🥳 jupyter-notebook has been installed\n\n"
1919
else
2020
echo "🥳 jupyter-notebook is already installed\n\n"
2121
fi
2222

2323
echo "👷 Starting jupyter-notebook in background..."
2424
echo "check logs at ${LOG_PATH}"
25-
$HOME/.local/bin/jupyter notebook --NotebookApp.ip='0.0.0.0' --ServerApp.port=${PORT} --no-browser --ServerApp.token='' --ServerApp.password='' > ${LOG_PATH} 2>&1 &
25+
$HOME/.local/bin/jupyter-notebook --NotebookApp.ip='0.0.0.0' --ServerApp.port=${PORT} --no-browser --ServerApp.token='' --ServerApp.password='' > ${LOG_PATH} 2>&1 &

jupyterlab/main.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const executeScriptInContainerWithPip = async (
2222
}> => {
2323
const instance = findResourceInstance(state, "coder_script");
2424
const id = await runContainer(image);
25-
const respPip = await execContainer(id, [shell, "-c", "apk add py3-pip"]);
25+
const respPipx = await execContainer(id, [shell, "-c", "apk add pipx"]);
2626
const resp = await execContainer(id, [shell, "-c", instance.script]);
2727
const stdout = resp.stdout.trim().split("\n");
2828
const stderr = resp.stderr.trim().split("\n");
@@ -40,22 +40,22 @@ describe("jupyterlab", async () => {
4040
agent_id: "foo",
4141
});
4242

43-
it("fails without pip3", async () => {
43+
it("fails without pipx", async () => {
4444
const state = await runTerraformApply(import.meta.dir, {
4545
agent_id: "foo",
4646
});
4747
const output = await executeScriptInContainer(state, "alpine");
4848
expect(output.exitCode).toBe(1);
4949
expect(output.stdout).toEqual([
5050
"\u001B[0;1mInstalling jupyterlab!",
51-
"pip3 is not installed",
52-
"Please install pip3 in your Dockerfile/VM image before running this script",
51+
"pipx is not installed",
52+
"Please install pipx in your Dockerfile/VM image before running this script",
5353
]);
5454
});
5555

56-
// TODO: Add faster test to run with pip3.
56+
// TODO: Add faster test to run with pipx.
5757
// currently times out.
58-
// it("runs with pip3", async () => {
58+
// it("runs with pipx", async () => {
5959
// ...
6060
// const output = await executeScriptInContainerWithPip(state, "alpine");
6161
// ...

jupyterlab/run.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ printf "$${BOLD}Installing jupyterlab!\n"
77
# check if jupyterlab is installed
88
if ! command -v jupyterlab > /dev/null 2>&1; then
99
# install jupyterlab
10-
# check if python3 pip is installed
11-
if ! command -v pip3 > /dev/null 2>&1; then
12-
echo "pip3 is not installed"
13-
echo "Please install pip3 in your Dockerfile/VM image before running this script"
10+
# check if pipx is installed
11+
if ! command -v pipx > /dev/null 2>&1; then
12+
echo "pipx is not installed"
13+
echo "Please install pipx in your Dockerfile/VM image before running this script"
1414
exit 1
1515
fi
1616
# install jupyterlab
17-
pip3 install --upgrade --no-cache-dir --no-warn-script-location jupyterlab
17+
pipx install -q jupyterlab
1818
echo "🥳 jupyterlab has been installed\n\n"
1919
else
2020
echo "🥳 jupyterlab is already installed\n\n"
2121
fi
2222

2323
echo "👷 Starting jupyterlab in background..."
2424
echo "check logs at ${LOG_PATH}"
25-
$HOME/.local/bin/jupyter lab --ServerApp.ip='0.0.0.0' --ServerApp.port=${PORT} --no-browser --ServerApp.token='' --ServerApp.password='' > ${LOG_PATH} 2>&1 &
25+
$HOME/.local/bin/jupyter-lab --ServerApp.ip='0.0.0.0' --ServerApp.port=${PORT} --no-browser --ServerApp.token='' --ServerApp.password='' > ${LOG_PATH} 2>&1 &

0 commit comments

Comments
 (0)
0