setuptools icon indicating copy to clipboard operation
setuptools copied to clipboard

HF_HUB_VERSION = version.parse(importlib.metadata.version("huggingface_hub"))

Open sshenshuo opened this issue 1 year ago • 3 comments

setuptools version

huggingface_hub

Python version

py3.8

OS

linux

Additional environment information

No response

Description

HF_HUB_VERSION = version.parse(importlib.metadata.version("huggingface_hub"))

How to Reproduce

Successfully installed huggingface_hub-0.25.0 aistudio@jupyter-16705695-8894579:~/PaddleMIX/ppdiffusers/examples/stable_diffusion$ sh train.sh /home/aistudio/.local/lib/python3.8/site-packages/_distutils_hack/init.py:31: UserWarning: Setuptools is replacing distutils. Support for replacing an already imported distutils is deprecated. In the future, this condition will fail. Register concerns at https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml warnings.warn( Traceback (most recent call last): File "train_txt2img_laion400m_trainer.py", line 19, in from paddlenlp.trainer import PdArgumentParser, get_last_checkpoint, set_seed File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/init.py", line 35, in from . import ( File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/dataaug/init.py", line 17, in from .sentence import * File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/dataaug/sentence.py", line 17, in from ..taskflow import Taskflow File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/taskflow/init.py", line 15, in from .taskflow import Taskflow File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/taskflow/taskflow.py", line 26, in from .information_extraction import GPTask, UIETask File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/taskflow/information_extraction.py", line 26, in from ..datasets import load_dataset File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/datasets/init.py", line 15, in from .bellegroup import * File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/datasets/bellegroup.py", line 22, in from .dataset import DatasetBuilder File "/home/aistudio/.local/lib/python3.8/site-packages/paddlenlp/datasets/dataset.py", line 23, in import datasets File "/home/aistudio/.local/lib/python3.8/site-packages/datasets/init.py", line 17, in from .arrow_dataset import Dataset File "/home/aistudio/.local/lib/python3.8/site-packages/datasets/arrow_dataset.py", line 75, in from . import config File "/home/aistudio/.local/lib/python3.8/site-packages/datasets/config.py", line 40, in HF_HUB_VERSION = version.parse(importlib.metadata.version("huggingface_hub")) File "/home/aistudio/.local/lib/python3.8/site-packages/packaging/version.py", line 56, in parse return Version(version) File "/home/aistudio/.local/lib/python3.8/site-packages/packaging/version.py", line 200, in init match = self._regex.search(version) TypeError: expected string or bytes-like object

Other detail


sshenshuo avatar Apr 09 '25 08:04 sshenshuo

From the description, it is not clear how the specific failure in HF_HUB_VERSION = version.parse(importlib.metadata.version("huggingface_hub")) is related to setuptools.

To proceed investigation we need a more complete reproducer. Please have a look on https://stackoverflow.com/help/minimal-reproducible-example.

If possible, please use a docker container to create the reproducer. This is very useful because ensures the error is reproducible in an isolated environment.

Also note that setuptools no longer supports Python 3.8, so please consider a new Python version when creating the reproducer.

abravalheri avatar Apr 09 '25 09:04 abravalheri

Regarding the warning about setuptools. This means that somewhere, something is importing distutils.

If you wish to register a concern, please describe in detail the use case and why you cannot replace distutils with a different package.

Please have a look on https://peps.python.org/pep-0632/#migration-advice and https://setuptools.pypa.io/en/latest/deprecated/index.html for suggestions.

abravalheri avatar Apr 09 '25 09:04 abravalheri

The error doesn't seem related to setuptools at all. It's bewteen a direct usage of packaging, importlib.metadata, and huggingface_hub.

As for the warning, there's an arbitrary train.sh script being run here that I can't find in https://github.com/PaddlePaddle/PaddleMIX/tree/develop/ppdiffusers/examples/stable_diffusion either. Without seeing the script content the best we can say is distutils usage should be fixed there. (ie: don't use or patch distutils directly)

Avasam avatar Feb 09 '26 12:02 Avasam