Skip to content

fix(scripts): replace pkg_resources in collect_info.py - #2386

Open
Hemang Varshney (hemv-857) wants to merge 1 commit into
microsoft:mainfrom
hemv-857:fix/2354-collect-info-importlib-metadata
Open

Hemang Varshney (hemv-857) wants to merge 1 commit into
microsoft:mainfrom
hemv-857:fix/2354-collect-info-importlib-metadata

Conversation

@hemv-857

Copy link
Copy Markdown

Summary

scripts/collect_info.py imports pkg_resources at module level. setuptools 82 removed that module, so the script the bug template points users to dies before printing anything. wheel and cython are build requirements, not runtime dependencies, so get_distribution can also raise DistributionNotFound for a normal install.

Replace pkg_resources.get_distribution with importlib.metadata.version and print not installed for packages that are absent instead of raising.

Fixes #2354.

Verification

With qlib and fire stubbed, InfoCollector().qlib() now completes and prints values such as:

setuptools==not installed
wheel==0.47.0
cython==not installed

setuptools 82 no longer ships pkg_resources, so collect_info.py failed on its first import. Use importlib.metadata and report packages that are not installed instead of raising DistributionNotFound.
Copilot AI balanced review requested due to automatic review settings October 24, 2026 05:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@hemv-857

Copy link
Copy Markdown
Author

Gentle ping after three weeks. The change is one file (scripts/collect_info.py), +6/-3: pkg_resources.get_distribution becomes importlib.metadata.version, and a package that is not installed prints not installed instead of raising. That matters because setuptools 82 removed pkg_resources, so the script the bug template points users to currently dies before printing the environment.

CI here only reports the CLA check, so there is no test signal to read. Is there anything you would like changed before review?

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.

collect_info.py does not start: pkg_resources is gone from setuptools 82

2 participants