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

ImportError: cannot import name 'NoneType' from 'types' on main #35827

Open
1 of 4 tasks
harupy opened this issue Jan 22, 2025 · 1 comment · May be fixed by #35829
Open
1 of 4 tasks

ImportError: cannot import name 'NoneType' from 'types' on main #35827

harupy opened this issue Jan 22, 2025 · 1 comment · May be fixed by #35829
Labels

Comments

@harupy
Copy link
Contributor

harupy commented Jan 22, 2025

System Info

Linux

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

docker run python:3.9 bash -c 'pip install git+https://github.com/huggingface/transformers && python -c "import transformers"'

Output:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/transformers/__init__.py", line 26, in <module>
    from . import dependency_versions_check
  File "/usr/local/lib/python3.9/site-packages/transformers/dependency_versions_check.py", line 16, in <module>
    from .utils.versions import require_version, require_version_core
  File "/usr/local/lib/python3.9/site-packages/transformers/utils/__init__.py", line 27, in <module>
    from .chat_template_utils import DocstringParsingException, TypeHintParsingException, get_json_schema
  File "/usr/local/lib/python3.9/site-packages/transformers/utils/chat_template_utils.py", line 22, in <module>
    from types import NoneType
ImportError: cannot import name 'NoneType' from 'types' (/usr/local/lib/python3.9/types.py)

Expected behavior

No import error

@harupy harupy added the bug label Jan 22, 2025
@harupy
Copy link
Contributor Author

harupy commented Jan 22, 2025

types.None only exists in Python >= 3.10.

https://docs.python.org/3/library/types.html#types.NoneType

@harupy harupy changed the title ImportError: cannot import name 'NoneType' from 'types' ImportError: cannot import name 'NoneType' from 'types' on main Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant