Skip to content

build: ➖ Remove pkg_resources usage to fix Python 3.12 failure#3326

Open
pekat-vojtech-kovacik wants to merge 1 commit into
open-mmlab:mainfrom
pekat-vision:fix/remove-pkg-resources
Open

build: ➖ Remove pkg_resources usage to fix Python 3.12 failure#3326
pekat-vojtech-kovacik wants to merge 1 commit into
open-mmlab:mainfrom
pekat-vision:fix/remove-pkg-resources

Conversation

@pekat-vojtech-kovacik

Copy link
Copy Markdown

Motivation

Python 3.12 removes pkg_resources, which causes MMCV to fail during PEP 517
build isolation with the following error:

ModuleNotFoundError: No module named 'pkg_resources'

This breaks installation for Python 3.12, even though the affected code paths are only used for version handling.

Modification

Replaces: pkg_resources.get_distribution and pkg_resources.parse_version
with: importlib.metadata.version and packaging.version.parse

Removes pkg_resources from build/tooling configuration

Use cases (Optional)

This change allows MMCV to be installed successfully on Python 3.12

Checklist

Before PR:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • New functionalities are covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with some of those projects, like MMDet or MMCls.
  • CLA has been signed and all committers have signed the CLA in this PR.

@CLAassistant

CLAassistant commented Feb 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

yuki-inaho added a commit to yuki-inaho/mmcv that referenced this pull request May 29, 2026
Replace the pkg_resources import (removed in setuptools>=81) with importlib.metadata
+ packaging.version (open-mmlab#3326/open-mmlab#3328). The wheel build no longer needs the
setuptools<81 workaround, so the GitHub Action and justfile build-wheel now install
plain setuptools (+ packaging).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants