Spaces:
Running
Running
openhands commited on
Commit ·
14c27ac
1
Parent(s): 76eaf68
fix: install jupyter in Dockerfile build instead of runtime
Browse files- Always install jupyterlab in Dockerfile build (not conditional on DEV_MODE)
- Check jupyter via python import instead of command -v
- Runtime install only as fallback if import fails
- Dockerfile +4 -7
- start.sh +4 -3
Dockerfile
CHANGED
|
@@ -49,13 +49,10 @@ RUN apt-get update && apt-get install -y \
|
|
| 49 |
xfonts-scalable \
|
| 50 |
--no-install-recommends && \
|
| 51 |
pip3 install --no-cache-dir --break-system-packages huggingface_hub && \
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
tornado==6.5.5 \
|
| 57 |
-
ipywidgets==8.1.8 ;; \
|
| 58 |
-
esac && \
|
| 59 |
rm -rf /var/lib/apt/lists/*
|
| 60 |
|
| 61 |
# Reuse existing node user (UID 1000). Allow passwordless package-manager
|
|
|
|
| 49 |
xfonts-scalable \
|
| 50 |
--no-install-recommends && \
|
| 51 |
pip3 install --no-cache-dir --break-system-packages huggingface_hub && \
|
| 52 |
+
pip3 install --no-cache-dir --break-system-packages \
|
| 53 |
+
jupyterlab==4.5.7 \
|
| 54 |
+
tornado==6.5.5 \
|
| 55 |
+
ipywidgets==8.1.8 && \
|
|
|
|
|
|
|
|
|
|
| 56 |
rm -rf /var/lib/apt/lists/*
|
| 57 |
|
| 58 |
# Reuse existing node user (UID 1000). Allow passwordless package-manager
|
start.sh
CHANGED
|
@@ -749,10 +749,11 @@ if [ -n "${CLOUDFLARE_PROXY_URL:-}" ]; then
|
|
| 749 |
echo "Proxy : ${CLOUDFLARE_PROXY_URL}"
|
| 750 |
fi
|
| 751 |
RUNTIME_JUPYTER_ENABLED="$DEV_MODE_ENABLED"
|
| 752 |
-
# Add user bin to PATH for jupyter-lab
|
| 753 |
export PATH="$HOME/.local/bin:$PATH"
|
| 754 |
|
| 755 |
-
|
|
|
|
| 756 |
echo "DEV_MODE enabled but jupyter-lab is missing; attempting runtime install..."
|
| 757 |
if python3 -m pip install --user --no-cache-dir --break-system-packages jupyterlab==4.5.7 tornado==6.5.5 ipywidgets==8.1.8; then
|
| 758 |
echo "Runtime Jupyter install complete."
|
|
@@ -761,7 +762,7 @@ if [ "$DEV_MODE_ENABLED" = "true" ] && ! command -v jupyter-lab >/dev/null 2>&1;
|
|
| 761 |
RUNTIME_JUPYTER_ENABLED=false
|
| 762 |
fi
|
| 763 |
fi
|
| 764 |
-
if [ "$RUNTIME_JUPYTER_ENABLED" = "true" ] && !
|
| 765 |
echo "WARNING: jupyter-lab still unavailable; disabling terminal for this boot."
|
| 766 |
RUNTIME_JUPYTER_ENABLED=false
|
| 767 |
fi
|
|
|
|
| 749 |
echo "Proxy : ${CLOUDFLARE_PROXY_URL}"
|
| 750 |
fi
|
| 751 |
RUNTIME_JUPYTER_ENABLED="$DEV_MODE_ENABLED"
|
| 752 |
+
# Add user bin to PATH for jupyter-lab (installed in Dockerfile build)
|
| 753 |
export PATH="$HOME/.local/bin:$PATH"
|
| 754 |
|
| 755 |
+
# Skip runtime install since jupyter is installed during build
|
| 756 |
+
if [ "$DEV_MODE_ENABLED" = "true" ] && ! python3 -c "import jupyterlab" >/dev/null 2>&1; then
|
| 757 |
echo "DEV_MODE enabled but jupyter-lab is missing; attempting runtime install..."
|
| 758 |
if python3 -m pip install --user --no-cache-dir --break-system-packages jupyterlab==4.5.7 tornado==6.5.5 ipywidgets==8.1.8; then
|
| 759 |
echo "Runtime Jupyter install complete."
|
|
|
|
| 762 |
RUNTIME_JUPYTER_ENABLED=false
|
| 763 |
fi
|
| 764 |
fi
|
| 765 |
+
if [ "$RUNTIME_JUPYTER_ENABLED" = "true" ] && ! python3 -c "import jupyterlab" >/dev/null 2>&1; then
|
| 766 |
echo "WARNING: jupyter-lab still unavailable; disabling terminal for this boot."
|
| 767 |
RUNTIME_JUPYTER_ENABLED=false
|
| 768 |
fi
|