# UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30.

- **ID:** `python/setuptools-pkg-resources-deprecated-removed`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Code (directly or via a dependency) imports pkg_resources, which setuptools has deprecated and scheduled for removal. Common in older packages using pkg_resources.get_distribution or resource_filename.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8+ | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   from importlib.metadata import version, distribution
print(version('requests'))

from importlib.resources import files
# replaces pkg_resources.resource_filename
path = files('mypkg').joinpath('data.txt')
   ```
2. **** (80% success)
   ```
   python -W error::DeprecationWarning -c 'import mypkg'  # traceback shows importer
pip install -U <offending-package>  # upgrade to a release using importlib
   ```

## Dead Ends

- **** — Hides the symptom only; the import still executes and will hard-fail once pkg_resources is removed. Also masks the real migration need. (80% fail)
- **** — Pins you to an unsupported setuptools, breaks modern build backends, and merely defers the removal. Downstream packages may require newer setuptools. (75% fail)
