Skip to content

Dockerfile build fails to uninstall 'packaging' distutils #2483

@brooke-hamilton

Description

@brooke-hamilton

Bug information

Steps to reproduce (required)

  1. Run the Test Samples (K3D) workflow. The workflow triggers a Dockerfile build in samples/volumes/Dockerfile.
  2. The build step executes RUN python3 -m pip install --upgrade pip setuptools wheel && python3 -m pip install --no-cache-dir -r requirements.txt on an Alpine Python image.

Observed behavior (required)

  • The build fails with the following error:
ERROR: Cannot uninstall 'packaging'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
ERROR: process "/bin/sh -c python3 -m pip install --upgrade pip setuptools wheel     && python3 -m pip install --no-cache-dir -r requirements.txt" did not complete successfully: exit code: 1
  • This error originates from the existing packaging distutils project in the image. Pip cannot uninstall it cleanly.
  • The failure is traced to this line in the Dockerfile:
RUN python3 -m pip install --upgrade pip setuptools wheel 
    && python3 -m pip install --no-cache-dir -r requirements.txt

Desired behavior (required)

  • The Docker image build and all workflow steps should complete successfully.

Workaround (optional)

  • Use a Python base image that does not have distutils-preinstalled packages or
  • Specify --ignore-installed for pip, or
  • Update the Dockerfile step to check for an existing installation and avoid upgrading/distutils uninstall.

Suggested fix

  • Consider switching to a Python official base image (e.g. python:3.10-alpine instead of alpine:3.14) which installs packages cleanly via pip.
  • Alternatively, update the Dockerfile to explicitly install packaging before upgrading pip, or use --ignore-installed with pip install.
  • See the logs in Workflow Run 21015933695/job/63031933365 for context.

System information

rad Version (required)

Operating system (required)

Additional context

AB#18169

Metadata

Metadata

Labels

bugSomething is broken or not working as expected

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions