VibecoderMcSwaggins commited on
Commit
9d33523
·
1 Parent(s): d9cd722

fix(docker): run app inside isles_ensemble conda environment

Browse files

ROOT CAUSE FOUND: DeepISLES uses a conda env called 'isles_ensemble'.
All PyTorch/nnU-Net dependencies are ONLY in that conda env.
We were running with system Python which couldn't import anything.

Fix:
- Install deps into conda env: source activate isles_ensemble && pip install
- Run app in conda env: source activate isles_ensemble && python -m ...

The path fix (/home/user/demo) was correct but insufficient without conda.

Files changed (1) hide show
  1. Dockerfile +10 -8
Dockerfile CHANGED
@@ -31,8 +31,9 @@ WORKDIR /home/user/demo
31
  # Copy requirements first for better layer caching
32
  COPY --chown=1000:1000 requirements.txt /home/user/demo/requirements.txt
33
 
34
- # Install Python dependencies (extras only - DeepISLES image has PyTorch, nnUNet, etc.)
35
- RUN pip install --no-cache-dir -r requirements.txt
 
36
 
37
  # Copy application source code and package files
38
  COPY --chown=1000:1000 pyproject.toml /home/user/demo/pyproject.toml
@@ -40,9 +41,9 @@ COPY --chown=1000:1000 README.md /home/user/demo/README.md
40
  COPY --chown=1000:1000 src/ /home/user/demo/src/
41
  COPY --chown=1000:1000 app.py /home/user/demo/app.py
42
 
43
- # Install the package itself (makes stroke_deepisles_demo importable)
44
  # Using --no-deps since requirements.txt already installed dependencies
45
- RUN pip install --no-cache-dir --no-deps -e .
46
 
47
  # Set environment variable to indicate we're running in HF Spaces
48
  # This allows the app to detect runtime environment and use direct invocation
@@ -66,9 +67,10 @@ USER user
66
  # Expose the Gradio port
67
  EXPOSE 7860
68
 
69
- # IMPORTANT: Reset ENTRYPOINT from base image (DeepISLES sets ENTRYPOINT to main.py)
70
- # Without this, our CMD gets passed as arguments to DeepISLES's main.py
 
71
  ENTRYPOINT []
72
 
73
- # Set the default command to run our Gradio app
74
- CMD ["python", "-m", "stroke_deepisles_demo.ui.app"]
 
31
  # Copy requirements first for better layer caching
32
  COPY --chown=1000:1000 requirements.txt /home/user/demo/requirements.txt
33
 
34
+ # Install Python dependencies INTO THE CONDA ENVIRONMENT
35
+ # DeepISLES uses 'isles_ensemble' conda env - we must install there
36
+ RUN /bin/bash -c "source activate isles_ensemble && pip install --no-cache-dir -r requirements.txt"
37
 
38
  # Copy application source code and package files
39
  COPY --chown=1000:1000 pyproject.toml /home/user/demo/pyproject.toml
 
41
  COPY --chown=1000:1000 src/ /home/user/demo/src/
42
  COPY --chown=1000:1000 app.py /home/user/demo/app.py
43
 
44
+ # Install the package itself INTO THE CONDA ENVIRONMENT
45
  # Using --no-deps since requirements.txt already installed dependencies
46
+ RUN /bin/bash -c "source activate isles_ensemble && pip install --no-cache-dir --no-deps -e ."
47
 
48
  # Set environment variable to indicate we're running in HF Spaces
49
  # This allows the app to detect runtime environment and use direct invocation
 
67
  # Expose the Gradio port
68
  EXPOSE 7860
69
 
70
+ # IMPORTANT: DeepISLES uses a conda environment called 'isles_ensemble'
71
+ # All PyTorch/nnU-Net dependencies are ONLY available in that conda env
72
+ # We must run our app inside that environment to access DeepISLES imports
73
  ENTRYPOINT []
74
 
75
+ # Run our Gradio app inside the isles_ensemble conda environment
76
+ CMD ["/bin/bash", "-c", "source activate isles_ensemble && python -m stroke_deepisles_demo.ui.app"]