Spaces:
Paused
Paused
fix: use venv python for JupyterLab — system python3 lacks jupyterlab
Browse filesjupyterlab is installed into /opt/hermes/.venv, not system python3.
start_jupyter() was calling python3 -c "import jupyterlab" which fails
on system python → returned 1 → set -euo pipefail killed start.sh →
container crashed every boot → HF Space stuck in RUNNING_APP_STARTING.
Fixes:
- Use /opt/hermes/.venv/bin/python for the import check and launch
- Change failing return 1s in start_jupyter to return 0 (non-fatal)
- Restore HEALTHCHECK with 60s start-period (was accidentally removed)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Files changed (2)
- Dockerfile+2-1
- start.sh+6-5
96 unmodified lines97989910010110296 unmodified linesEXPOSE 7861HEALTHCHECK NONECMD ["/opt/huggingmes/start.sh"]96 unmodified lines97989910010110210396 unmodified linesEXPOSE 7861HEALTHCHECK --interval=30s --timeout=5s --start-period=60s \CMD curl -fsS http://localhost:7861/health || exit 1CMD ["/opt/huggingmes/start.sh"]
317 unmodified lines318319320321322323324325326327328329330331332333334335317 unmodified lineslocal token="${JUPYTER_TOKEN:-${API_SERVER_KEY:-}}"if [ -z "$token" ]; thenecho "WARNING: No GATEWAY_TOKEN or JUPYTER_TOKEN set — JupyterLab skipped (terminal would be unauthenticated)." >&2return 1fiexport JUPYTER_TOKEN="$token"if ! python3 -c "import jupyterlab" >/dev/null 2>&1; thenecho "WARNING: jupyterlab not installed; skipping terminal." >&2return 1filocal root_dir="${JUPYTER_ROOT_DIR:-$HERMES_HOME/workspace}"mkdir -p "$root_dir"ln -sfn "$HERMES_HOME" "$root_dir/HuggingMes" 2>/dev/null || trueecho "Starting JupyterLab terminal on port 8888 (path: /terminal/) root: $root_dir"python3 -m jupyterlab \--ip 127.0.0.1 \--port 8888 \--no-browser \317 unmodified lines318319320321322323324325326327328329330331332333334335336317 unmodified lineslocal token="${JUPYTER_TOKEN:-${API_SERVER_KEY:-}}"if [ -z "$token" ]; thenecho "WARNING: No GATEWAY_TOKEN or JUPYTER_TOKEN set — JupyterLab skipped (terminal would be unauthenticated)." >&2return 0fiexport JUPYTER_TOKEN="$token"local VENV_PYTHON="/opt/hermes/.venv/bin/python"if ! "$VENV_PYTHON" -c "import jupyterlab" >/dev/null 2>&1; thenecho "WARNING: jupyterlab not installed in venv; skipping terminal." >&2return 0filocal root_dir="${JUPYTER_ROOT_DIR:-$HERMES_HOME/workspace}"mkdir -p "$root_dir"ln -sfn "$HERMES_HOME" "$root_dir/HuggingMes" 2>/dev/null || trueecho "Starting JupyterLab terminal on port 8888 (path: /terminal/) root: $root_dir""$VENV_PYTHON" -m jupyterlab \--ip 127.0.0.1 \--port 8888 \--no-browser \
Dockerfile+2-1
start.sh+6-5