kaveh commited on
Commit
7ec84bf
·
1 Parent(s): 25776a3

fixed docker numpy issue

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -1
  2. requirements-docker.txt +2 -1
Dockerfile CHANGED
@@ -17,7 +17,9 @@ COPY requirements.txt requirements-docker.txt ./
17
 
18
  # Install Python dependencies - CPU-only PyTorch to fit Space memory limits (avoids OOM)
19
  # PyTorch 2.2 + torchvision 0.17 (CPU) - match requirements.txt torch>=2.0
20
- RUN pip install --no-cache-dir torch==2.2.0 torchvision==0.17.0 --index-url https://download.pytorch.org/whl/cpu && \
 
 
21
  pip install --no-cache-dir -r requirements-docker.txt
22
 
23
  # Copy app code (chown for HF Spaces permissions)
 
17
 
18
  # Install Python dependencies - CPU-only PyTorch to fit Space memory limits (avoids OOM)
19
  # PyTorch 2.2 + torchvision 0.17 (CPU) - match requirements.txt torch>=2.0
20
+ # Install numpy first with compatible version (<2) so torch.from_numpy works
21
+ RUN pip install --no-cache-dir "numpy>=1.20.0,<2.0" && \
22
+ pip install --no-cache-dir torch==2.2.0 torchvision==0.17.0 --index-url https://download.pytorch.org/whl/cpu && \
23
  pip install --no-cache-dir -r requirements-docker.txt
24
 
25
  # Copy app code (chown for HF Spaces permissions)
requirements-docker.txt CHANGED
@@ -1,5 +1,6 @@
1
  # Shape2Force App - deps for Docker (torch/torchvision installed separately from CPU wheel)
2
- numpy>=1.20.0
 
3
  opencv-python>=4.5.0
4
  scipy>=1.7.0
5
  scikit-image>=0.19.0
 
1
  # Shape2Force App - deps for Docker (torch/torchvision installed separately from CPU wheel)
2
+ # Pin numpy<2 for PyTorch 2.2 compatibility (torch.from_numpy fails with numpy 2.x)
3
+ numpy>=1.20.0,<2.0
4
  opencv-python>=4.5.0
5
  scipy>=1.7.0
6
  scikit-image>=0.19.0