stroke-viewer-frontend / docs /specs /archive /09-bug-deepisles-not-installed-hf-spaces.md
VibecoderMcSwaggins's picture
fix(ui): NiiVue viewer re-initializes after segmentation completes (#21)
0b424f6 unverified
|
raw
history blame
2.7 kB

Bug Spec: DeepISLES Path Conflict in Docker Build

Status: Root Cause Found β†’ Fix Ready Priority: P0 (Blocks inference) Branch: fix/deepisles-docker-path Date: 2025-12-08

Executive Summary

Our Dockerfile was overwriting DeepISLES modules by copying our app to /app/src/, which is where the base image stores DeepISLES code. The fix is to install our app at /home/user/demo instead.

Root Cause

The isleschallenge/deepisles:latest Docker image has this structure:

/app/
β”œβ”€β”€ main.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ src/                    ← DeepISLES Python modules
β”‚   └── isles22_ensemble.py
└── weights/                ← Model weights (~GB)

Our original Dockerfile:

FROM isleschallenge/deepisles:latest
WORKDIR /app
COPY src/ /app/src/         ← OVERWRITES DeepISLES modules!

This replaced /app/src/isles22_ensemble.py (DeepISLES) with /app/src/stroke_deepisles_demo/ (our app).

The Fix

  1. Changed app directory from /app to /home/user/demo
  2. Added DEEPISLES_PATH=/app environment variable
  3. Updated direct.py to check DEEPISLES_PATH first

Dockerfile Changes

# Before: WORKDIR /app
# After:
WORKDIR /home/user/demo

# Before: COPY src/ /app/src/
# After:
COPY src/ /home/user/demo/src/

# New:
ENV DEEPISLES_PATH=/app

direct.py Changes

def _get_deepisles_search_paths() -> list[str]:
    paths = []
    # Check environment variable first (set in Dockerfile)
    env_path = os.environ.get("DEEPISLES_PATH")
    if env_path:
        paths.append(env_path)
    # Add common installation locations
    paths.extend(["/app", "/DeepIsles", ...])
    return paths

Investigation Process

  1. Pulled isleschallenge/deepisles:latest locally
  2. Inspected WORKDIR: /app
  3. Listed /app contents: found src/, weights/, main.py
  4. Realized our COPY src/ /app/src/ was overwriting DeepISLES

Files Changed

  • Dockerfile - Use /home/user/demo, add DEEPISLES_PATH
  • src/stroke_deepisles_demo/inference/direct.py - Dynamic search paths

Testing

  • All 125 unit tests pass
  • Need to test on HF Spaces to verify inference works

References

Sources