Skip to content

AttributeError: module 'typing' has no attribute 'Unpack' #5185

Closed

Description

@oroppas

Feature

Missing Unpack in typing module. I encounter this when trying textual:

(venv) ryuta@orin:~/packages/rustpython$ rustpython -m textual
Traceback (most recent call last):
  File "/home/ryuta/packages/rustpython/rustpython/pylib/Lib/runpy.py", line 192, in _run_module_as_main
    sys.exit(msg)
  File "/home/ryuta/packages/rustpython/rustpython/pylib/Lib/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/ryuta/packages/rustpython/rustpython/pylib/Lib/runpy.py", line 151, in _get_module_details
    "be directly executed") %(e, mod_name))
  File "/home/ryuta/packages/rustpython/rustpython/pylib/Lib/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/ryuta/packages/rustpython/rustpython/pylib/Lib/runpy.py", line 117, in _get_module_details
    raise
  File "/home/ryuta/packages/rustpython/rustpython/pylib/Lib/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "_frozen_importlib", line 1461, in __import__
  File "_frozen_importlib", line 1382, in _gcd_import
  File "_frozen_importlib", line 1352, in _find_and_load
  File "_frozen_importlib", line 1355, in _find_and_load
  File "_frozen_importlib", line 1329, in _find_and_load_unlocked
  File "_frozen_importlib", line 1326, in _find_and_load_unlocked
  File "_frozen_importlib", line 1326, in _find_and_load_unlocked
  File "_frozen_importlib", line 945, in _load_unlocked
  File "_frozen_importlib", line 943, in _load_unlocked
  File "_frozen_importlib", line 936, in _load_unlocked
  File "_frozen_importlib", line 930, in _load_unlocked
  File "_frozen_importlib_external", line 994, in exec_module
  File "_frozen_importlib", line 488, in _call_with_frames_removed
  File "/home/ryuta/packages/rustpython/venv/lib/rustpython3.12/site-packages/textual/__init__.py", line 9, in <module>
    from . import constants
  File "/home/ryuta/packages/rustpython/venv/lib/rustpython3.12/site-packages/textual/constants.py", line 10, in <module>
    from typing_extensions import Final, TypeGuard
  File "/home/ryuta/packages/rustpython/venv/lib/rustpython3.12/site-packages/typing_extensions.py", line 2235, in <module>
    Unpack = typing.Unpack
AttributeError: module 'typing' has no attribute 'Unpack'

Python Documentation or reference to CPython source code

https://docs.python.org/3/library/typing.html#typing.Unpack
https://github.com/python/cpython/blob/3.12/Lib/typing.py#L1603

Activity

  1. added
    C-compatA discrepancy between RustPython and CPython
    on Mar 1, 2024
  2. coldnight commented on Dec 31, 2024

    @coldnight

    Same issue here, and solved by using the old version of get-pip.py: https://bootstrap.pypa.io/pip/3.7/get-pip.py

  3. starpit commented on Apr 17, 2025

    @starpit

    Related, not sure if this needs a separate top-level issue?

    from typing import Any, Self
    ImportError: cannot import name 'Self'
    
  4. moreal commented on Jan 20, 2026

    @moreal
    Contributor

    It seems like from typing import Any, Self, Unpack is working correctly now. Can we close this issue?

  5. youknowone commented on Jan 20, 2026

    @youknowone
    Member

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-compatA discrepancy between RustPython and CPython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions