Skip to content

UserWarning: pkg_resources is deprecated as an API #13974

Open
@tlienart

Description

@tlienart

I apologise in advance if this isn't the right repo to post this. I'm using google-cloud-* python libraries with python 3.12 and the UV package manager.

When loading a module like bigquery or storage in an interactive session such as ipython, I get:

In [1]: from google.cloud import storage
/${PATH}/.venv/lib/python3.12/site-packages/google/__init__.py:16:
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

In .venv/lib/python3.12/site-packages/google/__init__.py I can see:

try:
    import pkg_resources

    pkg_resources.declare_namespace(__name__)
except ImportError:
    import pkgutil

    __path__ = pkgutil.extend_path(__path__, __name__)

Pinning setuptools in my project to 80 does fix the warning message (so I could just go with this) but it's not ideal. Do you have recommendations to properly handle this warning message or is this something that can be expected to be fixed on the google.cloud side?

thanks

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions