Skip to content

Clean up duplicated micropipenv installations in pytorch+llmcompressor images #1999

@coderabbitai

Description

@coderabbitai

Problem Description

The pytorch+llmcompressor Docker images contain redundant micropipenv installations that create unnecessary build overhead and potential version inconsistencies.

Affected Files

  • runtimes/pytorch+llmcompressor/ubi9-python-3.11/Dockerfile.cuda
  • jupyter/pytorch+llmcompressor/ubi9-python-3.11/Dockerfile.cuda

Current Problematic Pattern

Each affected Dockerfile installs micropipenv twice:

  1. Early installation (for Pipfile.lock deployment):

    # Install micropipenv to deploy packages from Pipfile.lock
    RUN pip install --no-cache-dir -U "micropipenv[toml]"
  2. Later redundant installation (in requirements.txt block):

    # Install micropipenv and uv to deploy packages from requirements.txt begin
    RUN pip install --no-cache-dir -U "micropipenv[toml]==1.9.0" "uv==0.8.12"
    # Install micropipenv and uv to deploy packages from requirements.txt end

Impact

  • Build inefficiency: Unnecessary package download and installation time
  • Version inconsistency risk: Different micropipenv versions could be installed if the early install isn't pinned
  • Maintenance overhead: Duplicate installations to maintain and update

Solution Options

Option 1: Remove Early Installation (Recommended)

Remove the early micropipenv installation and rely only on the later pinned installation:

# Remove this block:
# Install micropipenv to deploy packages from Pipfile.lock
# RUN pip install --no-cache-dir -U "micropipenv[toml]==1.9.0"

# Keep only the later installation before micropipenv usage:
# Install micropipenv and uv to deploy packages from requirements.txt begin
RUN pip install --no-cache-dir -U "micropipenv[toml]==1.9.0" "uv==0.8.12"
# Install micropipenv and uv to deploy packages from requirements.txt end

# Then use micropipenv immediately after:
RUN echo "Installing softwares and packages" && \
    micropipenv install --dev && \
    ...

Option 2: Consolidate Installations

Move the micropipenv installation to just before its first usage and remove the later duplicate.

Option 3: Conditional Installation

Add logic to check if micropipenv is already installed before attempting reinstallation.

Acceptance Criteria

  • Remove duplicate micropipenv installations from all pytorch+llmcompressor Dockerfiles
  • Ensure micropipenv version consistency (1.9.0) across all installations
  • Verify that micropipenv install --dev still works correctly
  • Test image builds successfully for both affected variants
  • Confirm no other image types have similar duplication patterns
  • Update any related documentation if necessary

Implementation Notes

Context

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions