File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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)
55ARG PYTORCH_VARIANT=cpu
@@ -22,13 +22,15 @@ USER ${NB_UID}
2222# Set up the Conda environment
2323COPY docker/environment.yml /tmp/environment.yml
2424RUN 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 && \
You can’t perform that action at this time.
0 commit comments