Skip to content

setuptools pkg_resources deprecation warning and December removal #2240

@ABruihler

Description

@ABruihler

As of setuptools==80.9.0, when importing napalm, the following warning is shown about pkg_resources being deprecated and slated for removal in December:

Python 3.12.10 (main, Apr  9 2025, 03:49:38) [Clang 20.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import napalm
/Users/me/dir/.venv/lib/python3.12/site-packages/napalm/__init__.py:1: 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. Refrain from using this package or pin to Setuptools<81.
  import pkg_resources

The referenced setuptools link includes more details (emphasis mine):

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by packaging (e.g. requirements and version parsing). Users should refrain from new usage of pkg_resources and should work to port to importlib-based solutions.

setuptools issue #3085 and draft PR #5007 have some additional discussion.

In our project we have pinned setuptools<80.9.0 to avoid the warning for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions