# DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
UserWarning: pkg_resources is deprecated as an API.

- **ID:** `python/setuptools-pkg-resources-deprecation-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Code or a dependency imports `pkg_resources`, which setuptools deprecated in favor of `importlib.metadata` and `importlib.resources`; under `-W error` it becomes a hard failure.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Migrate imports: replace `import pkg_resources; pkg_resources.get_distribution('x').version` with `from importlib.metadata import version; version('x')`.
   ```
2. **** (70% success)
   ```
   If the warning comes from a dependency, pin a fixed version or open an issue; locally silence only that line with `warnings.filterwarnings('ignore', category=UserWarning, module='pkg_resources')`.
   ```

## Dead Ends

- **** — Only postpones the removal; newer deps require modern setuptools. (70% fail)
- **** — Hides real issues and the API may be removed in a future release. (50% fail)
