python
runtime_error
ai_generated
true
DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
ID: python/setuptools-pkg-resources-deprecation-warning
80%Fix Rate
86%Confidence
0Evidence
2024-05-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
The pkg_resources module from setuptools is deprecated and will be removed in future versions. Code or dependencies still import it, triggering the warning.
generic中文
setuptools 中的 pkg_resources 模块已被弃用,并将在未来版本中移除。代码或依赖项仍在导入它,从而触发警告。
Workarounds
-
85% success
Replace pkg_resources usage with importlib.metadata and importlib.resources from the standard library.
-
80% success
If the warning comes from a third-party package, update it to the latest version that no longer uses pkg_resources.
Dead Ends
Common approaches that don't work:
-
90% fail
Hides the warning but does not fix the underlying deprecated usage; future removal will break the code.
-
70% fail
Temporary workaround but loses security fixes and new features; not sustainable.