Spaces:
Running
Running
Fix jsonschema reinstall logic in start.sh
Browse filesReinstall jsonschema after devdata restore to fix circular import issues.
start.sh
CHANGED
|
@@ -760,14 +760,6 @@ RUNTIME_JUPYTER_ENABLED="$DEV_MODE_ENABLED"
|
|
| 760 |
# Add user bin to PATH for jupyter-lab (installed in Dockerfile when DEV_MODE=true)
|
| 761 |
export PATH="$HOME/.local/bin:$PATH"
|
| 762 |
|
| 763 |
-
# Fix: reinstall jsonschema if it is broken (circular import caused by partial install)
|
| 764 |
-
if [ "$DEV_MODE_ENABLED" = "true" ]; then
|
| 765 |
-
if ! python3 -c "import jsonschema" >/dev/null 2>&1; then
|
| 766 |
-
echo "jsonschema import failed — reinstalling..."
|
| 767 |
-
python3 -m pip install --force-reinstall --no-cache-dir --break-system-packages "jsonschema>=4.0" >/dev/null 2>&1 || true
|
| 768 |
-
fi
|
| 769 |
-
fi
|
| 770 |
-
|
| 771 |
# Runtime install fallback: only attempt if DEV_MODE is enabled but install failed during build
|
| 772 |
if [ "$DEV_MODE_ENABLED" = "true" ] && ! python3 -c "import jupyterlab" >/dev/null 2>&1; then
|
| 773 |
echo "DEV_MODE enabled but jupyter-lab is missing; attempting runtime install..."
|
|
@@ -930,6 +922,17 @@ if [ "$RUNTIME_JUPYTER_ENABLED" = "true" ] && \
|
|
| 930 |
echo "DevData : restore warning (non-fatal); continuing startup."
|
| 931 |
fi
|
| 932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 933 |
# 10.5. Start JupyterLab Terminal on internal port 8888 (DEV_MODE only)
|
| 934 |
# Accessible via /terminal/ path through the health-server proxy
|
| 935 |
if [ "$RUNTIME_JUPYTER_ENABLED" = "true" ]; then
|
|
|
|
| 760 |
# Add user bin to PATH for jupyter-lab (installed in Dockerfile when DEV_MODE=true)
|
| 761 |
export PATH="$HOME/.local/bin:$PATH"
|
| 762 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 763 |
# Runtime install fallback: only attempt if DEV_MODE is enabled but install failed during build
|
| 764 |
if [ "$DEV_MODE_ENABLED" = "true" ] && ! python3 -c "import jupyterlab" >/dev/null 2>&1; then
|
| 765 |
echo "DEV_MODE enabled but jupyter-lab is missing; attempting runtime install..."
|
|
|
|
| 922 |
echo "DevData : restore warning (non-fatal); continuing startup."
|
| 923 |
fi
|
| 924 |
|
| 925 |
+
# Fix: reinstall jsonschema AFTER devdata restore — restore can overwrite a broken
|
| 926 |
+
# version from .local/lib/python3.11/site-packages into the workspace, causing
|
| 927 |
+
# JupyterLab to crash with a circular import error on every boot.
|
| 928 |
+
if [ "$DEV_MODE_ENABLED" = "true" ]; then
|
| 929 |
+
if ! python3 -c "import jsonschema" >/dev/null 2>&1; then
|
| 930 |
+
echo "DevData : jsonschema broken after restore — reinstalling (circular import fix)..."
|
| 931 |
+
python3 -m pip install --force-reinstall --no-cache-dir --break-system-packages "jsonschema>=4.0" >/dev/null 2>&1 || true
|
| 932 |
+
echo "DevData : jsonschema reinstall done."
|
| 933 |
+
fi
|
| 934 |
+
fi
|
| 935 |
+
|
| 936 |
# 10.5. Start JupyterLab Terminal on internal port 8888 (DEV_MODE only)
|
| 937 |
# Accessible via /terminal/ path through the health-server proxy
|
| 938 |
if [ "$RUNTIME_JUPYTER_ENABLED" = "true" ]; then
|