Skip to content

Use importlib.metadata instead of deprecated pkg_resources in AzureContainerCodeExecutor - #8420

Open
LVsarff wants to merge 1 commit into
microsoft:mainfrom
LVsarff:fix-azure-executor-pkg-resources
Open

LVsarff wants to merge 1 commit into
microsoft:mainfrom
LVsarff:fix-azure-executor-pkg-resources

Conversation

@LVsarff

@LVsarff LVsarff commented Nov 3, 2026

Copy link
Copy Markdown

Description

AzureContainerCodeExecutor.get_available_packages runs a pkg_resources-based snippet inside the ACI container. pkg_resources ships with setuptools, which is not guaranteed to be present in the container's runtime environment, in which case get_available_packages() fails with ModuleNotFoundError. It is also deprecated (recent setuptools emits a DeprecationWarning on import).

This PR replaces the snippet with the standard-library equivalent:

from importlib.metadata import distributions
[d.metadata['Name'] for d in distributions()]

The output format (a repr of a list of package-name strings) is unchanged, so the downstream parsing is unaffected.

Fixes #8419

Checklist

  • The change is minimal and behavior-preserving
  • Verified the file compiles (python -m py_compile); no unit tests cover this container-side snippet today

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AzureContainerCodeExecutor.get_available_packages relies on deprecated pkg_resources inside the container

1 participant