Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version of packaging package #13454

Merged
merged 1 commit into from
Sep 6, 2021
Merged

Conversation

shivdhar
Copy link
Contributor

@shivdhar shivdhar commented Sep 6, 2021

This fixes an error when using packaging<20.0 with transformers.

With packaging==19.0:

ipython3
Python 3.6.14 (default, Jun 29 2021, 00:00:00) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.6.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import transformers                                                                                                                                             
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-279c49635b32> in <module>
----> 1 import transformers

~/.local/lib/python3.6/site-packages/transformers/__init__.py in <module>
     41 
     42 # Check the dependencies satisfy the minimal versions required.
---> 43 from . import dependency_versions_check
     44 from .file_utils import (
     45     _LazyModule,

~/.local/lib/python3.6/site-packages/transformers/dependency_versions_check.py in <module>
     34         if pkg == "tokenizers":
     35             # must be loaded here, or else tqdm check may fail
---> 36             from .file_utils import is_tokenizers_available
     37 
     38             if not is_tokenizers_available():

~/.local/lib/python3.6/site-packages/transformers/file_utils.py in <module>
    310 if _torch_available:
    311     torch_version = version.parse(importlib_metadata.version("torch"))
--> 312     _torch_fx_available = (torch_version.major, torch_version.minor) == (
    313         TORCH_FX_REQUIRED_VERSION.major,
    314         TORCH_FX_REQUIRED_VERSION.minor,

AttributeError: 'Version' object has no attribute 'major'

This is fixed with packaging>=20.0

The major attribute was added in v20.0 of packaging. Relevant changelog excerpt:

20.0 - 2020-01-06¶
Add major, minor, and micro aliases to packaging.version.Version (#226)

Therefore, have constrained version of packaging to '>=20.0'.

Please let me know if there are any setup.py-related tests to be updated.

CC @stas00 @sgugger

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you @shivdhar!

@LysandreJik LysandreJik merged commit 75858ca into huggingface:master Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants