Skip to content

Bug: pkg_resources is deprecated ==> replace pkg_resources.parse_version by packaging.version.parse #934

@thebaptiste

Description

@thebaptiste

What happened?

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

So you should replace pkg_resources.parse_version by packaging.version.parse

Relevant code

import tensorflow_hub

Relevant log output

==> You will have this warning message : 
"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"

tensorflow_hub Version

other (please specify)

TensorFlow Version

other (please specify)

Other libraries

I'm using tensorflow_hub 0.16.1 with tensorflow 2.20.0 on Python 3.13

To keep compatibility with setuptools >= 81 you should replace (__init__.py, line 61) :

from pkg_resources import parse_version

by

from packaging.version import parse as parse_version

Python Version

3.x

OS

Linux

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions