Skip to content

Bug: pkg_resources is removed in setuptools 82.0 ==> replace pkg_resources.parse_version by packaging.version.parse #934

@thebaptiste

Description

@thebaptiste

What happened?

pkg_resources (previously deprecated) has been removed in setuptools 82.0 (see setuptools changelog)

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

Relevant code

pip install tensorflow-hub #it will now install setuptools >= 82.0 as a dependency
python
import tensorflow_hub

Relevant log output

==> You will have this error message :

"File "[...]/tensorflow_hub/__init__.py", line 61, in _ensure_tf_install
    from pkg_resources import parse_version
ModuleNotFoundError: No module named 'pkg_resources'"

tensorflow_hub Version

0.16.1

TensorFlow Version

2.20.0

Other libraries

I'm using tensorflow_hub 0.16.1 with tensorflow 2.20.0 on Python 3.13 (but it should be the same with any tensorflow release or any Python version)

To keep compatibility with setuptools >= 82 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