Replace deprecated pkg_resources with importlib.metadata in profile_report.p

Author: yurivskiCreated Mar 9, 2026Updated Aug 6, 2026
Labelsneeds-triage

Current Behaviour

profile_report.py imports pkg_resources directly (line 11), which was removed from setuptools>=81. This causes ModuleNotFoundError: No module named 'pkg_resources' on fresh environments with modern setuptools.

The utils/versions.py file already uses importlib.metadata with a fallback — but profile_report.py was not updated.

Affected code

  • src/ydata_profiling/profile_report.py (lines 11 and 362)

Proposed fix

Replace pkg_resources.get_distribution("Pillow").version with importlib.metadata.version("Pillow"), which is available since Python 3.8.

Validation

Full test suite passes with the change on Python 3.13.5 (2195 passed, 4 skipped, 0 failures).

I'd like to work on this. Will open a PR once approved.

Expected Behaviour

ydata-profiling should work without requiring setuptools/pkg_resources at runtime.

Data Description

N/A - not data related

Code that reproduces the bug

python
pip install setuptools>=81
python3 -c "from ydata_profiling import ProfileReport"
# ModuleNotFoundError: No module named 'pkg_resources'

pandas-profiling version

4.18.1 (develop branch)

Dependencies

setuptools==78.1.1 (tested); bug triggers on setuptools>=81 where pkg_resources was removed
Python 3.13.5

OS

Linux (Parrot OS)

Checklist

  • There is not yet another bug report for this issue in the issue tracker
  • The problem is reproducible from this bug report. This guide can help to craft a minimal bug report.
  • The issue has not been resolved by the entries listed under Common Issues.

Source: Data-Centric-AI-Community/fg-data-profiling