build: ➖ Remove pkg_resources usage to fix Python 3.12 failure#3326
Open
pekat-vojtech-kovacik wants to merge 1 commit into
Open
build: ➖ Remove pkg_resources usage to fix Python 3.12 failure#3326pekat-vojtech-kovacik wants to merge 1 commit into
pekat-vojtech-kovacik wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_distributionandpkg_resources.parse_versionwith:
importlib.metadata.versionandpackaging.version.parseRemoves pkg_resources from build/tooling configuration
Use cases (Optional)
This change allows MMCV to be installed successfully on Python 3.12
Checklist
Before PR:
After PR: