Skip to content

Replace Docker with uv/pixi for dependency management #1

@shntnu

Description

@shntnu

Docker adds unnecessary complexity for what's primarily Python dependency management. It creates friction in the development process with longer build times and steeper learning curves.

Recommendation

  1. Use uv - Fast Python package installer and virtual environment manager
  2. Or pixi - If uv doesn't meet needs (better GPU/scientific package support)

Docker could still be used for Hail deployment, but for local development and testing, UV/PIXI would significantly improve developer experience.

Happy to create a PR implementing this approach if helpful.

cc: @afermg

FROM 'debian:12-slim'
ARG JXL_VERSION="0.11.1"
RUN apt update && \
# tools: python3, python3-pip, git, curl, moreutils (has parallel)
# dependencies for Pillow, opencv and libjxl: libtiff-dev zlib1g-dev libhwy-dev libgl1 libglib2.0-0
apt install -y python3 python3-pip git curl moreutils libtiff-dev zlib1g-dev libhwy-dev libgl1 libglib2.0-0 && \
curl -L --output jxl-linux-x86_64-static.tar.gz https://github.com/libjxl/libjxl/releases/download/v${JXL_VERSION}/jxl-linux-x86_64-static-v${JXL_VERSION}.tar.gz && \
tar -zxvf jxl-linux-x86_64-static.tar.gz && \
mv tools/* /usr/bin && \
curl -L --output jxl-debs-amd64-debian-bookworm.tar.gz https://github.com/libjxl/libjxl/releases/download/v${JXL_VERSION}/jxl-debs-amd64-debian-bookworm-v${JXL_VERSION}.tar.gz && \
tar -zxf jxl-debs-amd64-debian-bookworm.tar.gz && \
apt install -y ./libjxl_${JXL_VERSION}_amd64.deb ./libjxl-dev_${JXL_VERSION}_amd64.deb && \
rm /usr/lib/python*/EXTERNALLY-MANAGED && \
python3 -m pip install --no-cache-dir --upgrade pip && \
# torch in the debian12 repo is too old for cellpose
# CP-CNN requires efficientnet and tensorflow
# install all packages via pip (vs apt) since pip does not install torch if an outdated sympy is installed by apt
# pinning to TF 2.17 due to https://github.com/tensorflow/tensorflow/issues/78784 (current version is 2.18.0)
pip3 install --no-cache-dir torch pandas numpy scipy numba efficientnet tensorflow==2.17.1 tensorflow-cpu==2.17.1 git+https://github.com/olokelo/Pillow.git@jxl-support2 && \
# dependencies for cellpose
pip3 install --no-cache-dir tqdm opencv-python tifffile fastremap natsort roifile && \
git clone https://github.com/MouseLand/cellpose.git && \
mv cellpose/cellpose /usr/local/lib/python3.11/dist-packages/ && \
rm -rf jxl-debs-amd64-debian-bookworm.tar.gz jxl-linux-x86_64-static.tar.gz tools LICENSE.* /var/lib/apt/lists/* *jxl*.deb cellpose
# the nvidia-container-toolkit allows using the GPU on Hail Batch container without installing the full driver
RUN curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && \
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \
apt update && \
apt install -y nvidia-container-toolkit && \
rm -rf /var/lib/apt/lists/*
COPY cellpose /scripts/cellpose
COPY embeddings /scripts/embeddings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions