From d9e237ab12d09a2a85af460d6d4408a7f5608c5d Mon Sep 17 00:00:00 2001 From: Sarthak Pati Date: Fri, 15 Aug 2025 16:15:15 -0400 Subject: [PATCH] updated to uv installation and excludes --- .spelling/.spelling/excludes.txt | 2 ++ Dockerfile-CPU | 10 ++++++---- Dockerfile-CUDA11.8 | 10 ++++++---- Dockerfile-CUDA12.6 | 10 ++++++---- Dockerfile-ROCm | 10 ++++++---- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.spelling/.spelling/excludes.txt b/.spelling/.spelling/excludes.txt index be5d8dd28..ab6351ff4 100644 --- a/.spelling/.spelling/excludes.txt +++ b/.spelling/.spelling/excludes.txt @@ -8,7 +8,9 @@ ^\QGANDLF/grad_clipping/__init__.py\E$ ^\QGANDLF/models/seg_modules/__init__.py\E$ ^\QGANDLF/privacy/__init__.py\E$ +^\QGANDLF/configuration/__init__.py\E$ ^\Qtesting/__init__.py\E$ +^\Qsetup.py\E$ ^\Qtutorials/classification_medmnist_notebook/tutorial.ipynb\E$ ^samples/images_opm/ ^tutorials/classification_medmnist_notebook/medmnist/dataset/ diff --git a/Dockerfile-CPU b/Dockerfile-CPU index 936fbb56a..100faf326 100644 --- a/Dockerfile-CPU +++ b/Dockerfile-CPU @@ -7,6 +7,7 @@ ARG DEBIAN_FRONTEND=noninteractive # Install fresh Python and dependencies for build-from-source RUN apt-get update && apt-get install -y software-properties-common +RUN apt-get install -y git RUN add-apt-repository ppa:deadsnakes/ppa RUN apt install -y python3.11 RUN apt install -y libpython3.11-dev @@ -18,18 +19,19 @@ RUN apt install -y python3-pip RUN apt-get install -y libjpeg8-dev zlib1g-dev libffi-dev libgl1 # fix pip version because of weird PyYAML issue RUN python3.11 -m pip install --upgrade pip +RUN python3.11 -m pip install uv # EXPLICITLY install cpu versions of torch/torchvision (not all versions have +cpu modes on PyPI...) -RUN python3.11 -m pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cpu -RUN python3.11 -m pip install openvino-dev opencv-python-headless +RUN uv pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cpu --system +RUN uv pip install openvino-dev opencv-python-headless --system # Do some dependency installation separately here to make layer caching more efficient COPY ./setup.py ./setup.py RUN python3.11 -c "from setup import requirements; file = open('requirements.txt', 'w'); file.writelines([req + '\n' for req in requirements]); file.close()" \ - && python3.11 -m pip install -r ./requirements.txt + && uv pip install -r ./requirements.txt --system COPY . /GaNDLF WORKDIR /GaNDLF -RUN python3.11 -m pip install -e . +RUN uv pip install -e . --system # Entrypoint forces all commands given via "docker run" to go through python, CMD forces the default entrypoint script argument to be gandlf run # If a user calls "docker run gandlf:[tag] anonymize", it will resolve to running "gandlf anonymize" instead. # CMD is inherently overridden by args to "docker run", entrypoint is constant. diff --git a/Dockerfile-CUDA11.8 b/Dockerfile-CUDA11.8 index 4eb78ca5b..b9723e46f 100644 --- a/Dockerfile-CUDA11.8 +++ b/Dockerfile-CUDA11.8 @@ -10,6 +10,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Explicitly install python3.11 (this uses 11.1 for now, as PyTorch LTS 1.8.2 is built against it) RUN apt-get update && apt-get install -y software-properties-common +RUN apt-get install -y git RUN add-apt-repository ppa:deadsnakes/ppa RUN apt install -y python3.11 RUN apt install -y libpython3.11-dev @@ -21,17 +22,18 @@ RUN apt install -y python3-pip RUN apt-get install -y libjpeg8-dev zlib1g-dev libffi-dev libgl1 # fix pip version because of weird PyYAML issue RUN python3.11 -m pip install --upgrade pip -RUN python3.11 -m pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu118 -RUN python3.11 -m pip install openvino-dev opencv-python-headless +RUN python3.11 -m pip install uv +RUN uv pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu118 --system +RUN uv pip install openvino-dev opencv-python-headless --system # Do some dependency installation separately here to make layer caching more efficient COPY ./setup.py ./setup.py RUN python3.11 -c "from setup import requirements; file = open('requirements.txt', 'w'); file.writelines([req + '\n' for req in requirements]); file.close()" \ - && python3.11 -m pip install -r ./requirements.txt + && uv pip install -r ./requirements.txt --system COPY . /GaNDLF WORKDIR /GaNDLF -RUN python3.11 -m pip install -e . +RUN uv pip install -e . --system # Entrypoint forces all commands given via "docker run" to go through python, CMD forces the default entrypoint script argument to be gandlf run # If a user calls "docker run gandlf:[tag] anonymize", it will resolve to running "gandlf anonymize" instead. diff --git a/Dockerfile-CUDA12.6 b/Dockerfile-CUDA12.6 index b5717f3cb..6ce933b82 100644 --- a/Dockerfile-CUDA12.6 +++ b/Dockerfile-CUDA12.6 @@ -10,6 +10,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Explicitly install python3.11 (this uses 11.1 for now, as PyTorch LTS 1.8.2 is built against it) RUN apt-get update && apt-get install -y software-properties-common +RUN apt-get install -y git RUN add-apt-repository ppa:deadsnakes/ppa RUN apt install -y python3.11 RUN apt install -y libpython3.11-dev @@ -21,17 +22,18 @@ RUN apt install -y python3-pip RUN apt-get install -y libjpeg8-dev zlib1g-dev libffi-dev libgl1 # fix pip version because of weird PyYAML issue RUN python3.11 -m pip install --upgrade pip -RUN python3.11 -m pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu126 -RUN python3.11 -m pip install openvino-dev opencv-python-headless +RUN python3.11 -m pip install uv +RUN uv pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cu126 --system +RUN uv pip install openvino-dev opencv-python-headless --system # Do some dependency installation separately here to make layer caching more efficient COPY ./setup.py ./setup.py RUN python3.11 -c "from setup import requirements; file = open('requirements.txt', 'w'); file.writelines([req + '\n' for req in requirements]); file.close()" \ - && python3.11 -m pip install -r ./requirements.txt + && uv pip install -r ./requirements.txt --system COPY . /GaNDLF WORKDIR /GaNDLF -RUN python3.11 -m pip install -e . +RUN uv pip install -e . --system # Entrypoint forces all commands given via "docker run" to go through python, CMD forces the default entrypoint script argument to be gandlf run # If a user calls "docker run gandlf:[tag] anonymize", it will resolve to running "gandlf anonymize" instead. diff --git a/Dockerfile-ROCm b/Dockerfile-ROCm index 9bc835f14..fe2622e37 100644 --- a/Dockerfile-ROCm +++ b/Dockerfile-ROCm @@ -8,6 +8,7 @@ LABEL version=1.0 # The base image contains ROCm, python 3.9 and pytorch already, no need to install those RUN apt-get update && apt-get install -y software-properties-common +RUN apt-get install -y git RUN add-apt-repository ppa:deadsnakes/ppa RUN apt install -y python3.11 RUN apt install -y libpython3.11-dev @@ -19,17 +20,18 @@ RUN apt install -y python3-pip RUN apt-get install -y python3.11 python3-pip libjpeg8-dev zlib1g-dev python3-dev libpython3.11-dev libffi-dev libgl1 # fix pip version because of weird PyYAML issue RUN python3.11 -m pip install --upgrade pip -RUN python3.11 -m pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/rocm6.3 -RUN python3.11 -m pip install openvino-dev opencv-python-headless +RUN python3.11 -m pip install uv +RUN uv pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/rocm6.3 --system +RUN uv pip install openvino-dev opencv-python-headless --system # Do some dependency installation separately here to make layer caching more efficient COPY ./setup.py ./setup.py RUN python3.11 -c "from setup import requirements; file = open('requirements.txt', 'w'); file.writelines([req + '\n' for req in requirements]); file.close()" \ - && python3.11 -m pip install -r ./requirements.txt + && uv pip install -r ./requirements.txt --system COPY . /GaNDLF WORKDIR /GaNDLF -RUN python3.11 -m pip install -e . +RUN uv pip install -e . --system # Entrypoint forces all commands given via "docker run" to go through python, CMD forces the default entrypoint script argument to be gandlf run # If a user calls "docker run gandlf:[tag] anonymize", it will resolve to running "gandlf anonymize" instead.