{{ message }}
Fix: replace pkg_resources with importlib.metadata for setuptools 82+#1558
Open
junagent wants to merge 1 commit intonvbn:masterfrom
Open
Fix: replace pkg_resources with importlib.metadata for setuptools 82+#1558junagent wants to merge 1 commit intonvbn:masterfrom
junagent wants to merge 1 commit intonvbn:masterfrom
Conversation
Fixes nvbn#1552 pkg_resources was removed from setuptools 82.0.0 (PEP 740). This caused 'python setup.py' to fail with: ModuleNotFoundError: No module named 'pkg_resources' Replace pkg_resources.get_distribution("pip").version with importlib.metadata.version(), which is the stdlib equivalent available since Python 3.8. Verification: - setup.py runs without pkg_resources - pip version check still works (>=6 required) - Falls back gracefully if pip not installed
Author
loqs
suggested changes
Mar 21, 2026
Comment on lines
+11
to
+13
| print('pip older than 6.0 not supported, please upgrade pip with: | ||
|
|
||
| ' |
There was a problem hiding this comment.
This change is not related to the replacement of pkg_resources with importlib.metadata.
|
|
||
| if sys.platform == "win32": | ||
| scripts = ['scripts\\fuck.bat', 'scripts\\fuck.ps1'] | ||
| scripts = ['scripts\fuck.bat', 'scripts\fuck.ps1'] |
There was a problem hiding this comment.
How is this change related to the replacement of pkg_resources with importlib.metadata.
There was a problem hiding this comment.
setup.py lists python 2.7+ as supported however importlib.metadata is only available from python 3.8+. Should importlib-metadata not be used covering python 2.7 to 3.7 and should also be added to setup.py?
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.

Summary
pkg_resourceswas removed fromsetuptools82.0.0 (PEP 740). This causespython setup.pyto fail with:This PR replaces
pkg_resources.get_distribution("pip").versionwithimportlib.metadata.version(), which is the stdlib equivalent available since Python 3.8.Changes
setup.py— replace pkg_resources with importlib.metadata:Verification
python setup.py egg_info— works without pkg_resourcespython -m build(sdist) — works without pkg_resourcesRelated
Fixes #1552