Skip to content

Update - pkg_resources should be replaced with importlib #421

@lingster

Description

@lingster

I see this error, when using this in my app:

/app/.venvs/lib/python3.12/site-packages/numerbay/init.py:3: 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

https://stackoverflow.com/questions/7446187/no-module-named-pkg-resources

For people finding this question in 2025 or after:

Installing setuptools as proposed by most answers does work, but you should really replace pkg_resources with importlib.

For example, use

from importlib.metadata import version
version("pyjwt")
instead of

import pkg_resources
pkg_resources.get_distribution("pyjwt").version
Read more at https://setuptools.pypa.io/en/latest/pkg_resources.html

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