Skip to content

Commit c732796

Browse files
committed
Changes to Dockerfile
* Fix syntax * Force PyTorch uninstall first
1 parent 0e56fd5 commit c732796

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
@@ -1,5 +1,5 @@
11
# Stage 1: Build environment
2-
FROM quay.io/jupyter/minimal-notebook:latest as builder
2+
FROM quay.io/jupyter/minimal-notebook:latest AS builder
33

44
# Define build argument for PyTorch variant (cpu or cuda)
55
ARG PYTORCH_VARIANT=cpu
@@ -22,13 +22,15 @@ USER ${NB_UID}
2222
# Set up the Conda environment
2323
COPY docker/environment.yml /tmp/environment.yml
2424
RUN mamba env update -n base -f /tmp/environment.yml && \
25+
# Force remove any existing PyTorch installations first
26+
pip uninstall -y torch torchvision && \
2527
# Install PyTorch packages without cache - conditionally based on variant
2628
if [ "$PYTORCH_VARIANT" = "cpu" ]; then \
2729
echo "Installing CPU-only PyTorch" && \
28-
pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu; \
30+
pip install --no-cache-dir --force-reinstall torch torchvision --index-url https://download.pytorch.org/whl/cpu; \
2931
else \
3032
echo "Installing CUDA-enabled PyTorch" && \
31-
pip install --no-cache-dir torch torchvision; \
33+
pip install --no-cache-dir --force-reinstall torch torchvision; \
3234
fi && \
3335
# Clean up all package caches to reduce image size
3436
mamba clean --all -f -y && \

0 commit comments

Comments
 (0)