Disable rembg to fix build - numpy version conflict

rembg>=2.0.70 has an incompatible dependency chain:
- rembg requires scikit-image>=0.26.0
- scikit-image 0.26+ pulls in numpy 2.x
- opencv-python-headless 4.9.0.80 was compiled for numpy 1.x
- Runtime crash: "numpy.core.multiarray failed to import"

Fix: Revert to known-working numpy<2 stack:
- numpy<2.0.0 (explicit pin)
- Pillow 10.x (compatible with numpy 1.x)
- torch 2.1.2 / torchvision 0.16.2 (numpy 1.x compatible)
- Remove rembg and onnxruntime

Background removal endpoints will return 500 with "rembg not installed"
message (code already handles this gracefully).

To re-enable rembg in future: update opencv-python-headless to 4.10+
which supports numpy 2.x.

https://claude.ai/code/session_01MYpjNQXD1fZE4gCweGU4QQ
This commit is contained in:
Claude
2026-01-27 17:55:54 +00:00
parent 62ad349a83
commit 41598722f1
2 changed files with 13 additions and 14 deletions
+1 -4
View File
@@ -2,7 +2,7 @@ FROM python:3.11-slim
WORKDIR /app
# Install system dependencies for OpenCV, rembg, SAM, and image processing
# Install system dependencies for OpenCV, SAM, and image processing
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
@@ -20,9 +20,6 @@ COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download rembg model (u2net) to avoid first-run delay
RUN python -c "from rembg import remove; print('rembg model downloaded')" || true
# Copy application
COPY . .