Skip to content

Commit f4b040d

Browse files
committed
Fix numpy downgrade for SAM 3 compatibility
1 parent 4eeb409 commit f4b040d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ RUN pip install --no-cache-dir \
5353
torch torchvision torchaudio \
5454
--index-url https://download.pytorch.org/whl/cu126
5555

56-
# Downgrade numpy before SAM 3 (SAM 3 requires numpy<2, pip can't uninstall numpy 2.x cleanly)
57-
RUN pip install --no-cache-dir --ignore-installed "numpy>=1.26,<2"
56+
# Downgrade numpy before SAM 3 (SAM 3 requires numpy<2, pip can't uninstall numpy 2.x in-place)
57+
RUN rm -rf $(python3 -c "import numpy; import os; print(os.path.dirname(numpy.__file__))") \
58+
&& rm -rf /opt/venv/lib/python3.12/site-packages/numpy*.dist-info \
59+
&& pip install --no-cache-dir "numpy>=1.26,<2"
5860

5961
# SAM 3
6062
RUN git clone https://github.com/facebookresearch/sam3.git /opt/sam3 \
61-
&& pip install --no-cache-dir --no-deps -e /opt/sam3
63+
&& pip install --no-cache-dir -e /opt/sam3
6264

6365
# Remaining python deps (opencv pinned <4.11 for numpy 1.x compat)
6466
RUN pip install --no-cache-dir \

0 commit comments

Comments
 (0)