Skip to content

Old version of torch will be reinstalled. #2560

@phalanx-hk

Description

@phalanx-hk

Overview

  • uv version: 0.1.22
  • Problem
    • Installing timm==0.9.7 within ngc docker container will reinstall the old version of torch.
    • torch version:
      • ngc docker: 2.3.0a0+ebedce2
      • version requested by timm: >=1.7

Steps to Reproduce

Place the following Dockerfile and compose.yml in the current directory

FROM nvcr.io/nvidia/pytorch:24.02-py3

ARG UID=1000
ARG GID=1000
ARG USERNAME=vscode

ENV DEBIAN_FRONTEND=noninteractive \
    LANG=ja_JP.UTF-8 \
    TZ=Asia/Tokyo \
    apt_get_server=ftp.jaist.ac.jp/pub/Linux \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    VIRTUAL_ENV=/usr/

WORKDIR /workspace


SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN \
    # apt
    --mount=type=cache,target=/var/cache/apt \
    --mount=type=cache,target=/var/lib/apt \
    rm /etc/apt/apt.conf.d/docker-clean \
    && sed -i s@archive.ubuntu.com@${apt_get_server}@g /etc/apt/sources.list \
    && curl -sL https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | gpg --dearmor -o /etc/apt/keyrings/gierens.gpg \
    && echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | tee /etc/apt/sources.list.d/gierens.list \
    && chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list \
    && apt-get update \
    && apt-get install -y --no-install-recommends \
    bat \
    fd-find \
    ripgrep \
    eza \
    shellcheck \
    tmux \
    zsh \
    sudo \
    && ln -s "$(which batcat)" /usr/local/bin/bat \
    && ln -s "$(which fdfind)" /usr/local/bin/fd \
    # just command runner
    && curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin \
    # hadolint
    && curl -fSL "https://github.com/hadolint/hadolint/releases/download/$(curl -s https://api.github.com/repos/hadolint/hadolint/releases/latest | jq -r '.tag_name')/hadolint-Linux-x86_64" -o /usr/local/bin/hadolint \
    && chmod +x /usr/local/bin/hadolint \
    # uv
    && pip install --no-cache-dir uv \
    # add user
    && groupadd --gid ${GID} ${USERNAME} \
    && useradd -l --uid ${UID} --gid ${GID} -m ${USERNAME} \
    && echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USERNAME}

USER ${USERNAME}
services:
  kaggle:
    build:
      dockerfile: ./Dockerfile
      args:
        - UID=${UID}
        - GID=${GID}
    restart: always
    tty: true
    volumes:
      - type: bind
        source: .
        target: /workspace
        read_only: false
        consistency: cached
    ipc: host
    ulimits:
      memlock: -1
      stack: -1
    ports:
      - "8888:8888"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              capabilities: [gpu]
    command: jupyter lab --ip=0.0.0.0 --port 8888 --allow-root --NotebookApp.notebook_dir=/workspace --no-browser --LabApp.token=''

Run the following command

$ docker compose up -d
$ docker compose exec kaggle sudo uv pip install timm==0.9.7

Expected Result

torch is not reinstalled because it meets the requirements of timm, only timm is installed.

Actual Result

Installed 15 packages in 187ms
 + nvidia-cublas-cu12==12.1.3.1
 + nvidia-cuda-cupti-cu12==12.1.105
 + nvidia-cuda-nvrtc-cu12==12.1.105
 + nvidia-cuda-runtime-cu12==12.1.105
 + nvidia-cudnn-cu12==8.9.2.26
 + nvidia-cufft-cu12==11.0.2.54
 + nvidia-curand-cu12==10.3.2.106
 + nvidia-cusolver-cu12==11.4.5.107
 + nvidia-cusparse-cu12==12.1.0.106
 + nvidia-nccl-cu12==2.19.3
 + nvidia-nvjitlink-cu12==12.4.99
 + nvidia-nvtx-cu12==12.1.105
 + timm==0.9.7
 - torch==2.3.0a0+ebedce2 (from file:///tmp/pip/torch-2.3.0a0%2Bebedce2-cp310-cp310-linux_x86_64.whl)
 + torch==2.2.1
 - torchvision==0.18.0a0 (from file:///opt/pytorch/vision)
 + torchvision==0.17.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions