<#3959 [BUG] unhashable type error for list of Ann...
# flyte-github
a
#3959 [BUG] unhashable type error for list of Annotated Issue created by hududed Describe the bug Attempted to update
house_price_prediction/multiregion_house_price_predictor.py
, when appending
Annotated[...]
into a list, e.g.
list[Annotated[StructuredDataset, <..>]]
or
list[Annotated[pd.DataFrame, <..>]]
do not work for me - whatever type I put in
<..>
gives me unhashable error for that type. Expected behavior I expected the type check to pass, as is done originally with
typing.List[pd.DataFrame]
Additional context to reproduce 1. With the imported modules from
house_price_predictor.py
as-is, change L64-L69 to:
Copy code
dataset = typing.NamedTuple(
    "GenerateSplitDataOutputs",
    train_data=typing.List[Annotated[pd.DataFrame, COLUMNS]],
    val_data=typing.List[Annotated[pd.DataFrame, COLUMNS]],
    test_data=typing.List[Annotated[pd.DataFrame, COLUMNS]],
)
2. Run the notebook several times (this occured to me from second run onwards) Screenshots
Copy code
╭─────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────╮
│ in <module>:3                                                                                                   │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/task.py:260 in wrapper        │
│                                                                                                                 │
│ ❱ 260 │   │   task_instance = TaskPlugins.find_pythontask_plugin(type(task_config))(                            │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/tracker.py:35 in __call__     │
│                                                                                                                 │
│ ❱  35 │   │   o = super(InstanceTrackingMeta, cls).__call__(*args, **kwargs)                                    │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/python_function_task.py:121   │
│ in __init__                                                                                                     │
│                                                                                                                 │
│ ❱ 121 │   │   super().__init__(                                                                                 │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/python_auto_container.py:85   │
│ in __init__                                                                                                     │
│                                                                                                                 │
│ ❱  85 │   │   super().__init__(                                                                                 │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/base_task.py:420 in __init__  │
│                                                                                                                 │
│ ❱ 420 │   │   │   interface=transform_interface_to_typed_interface(interface),                                  │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/interface.py:248 in           │
│ transform_interface_to_typed_interface                                                                          │
│                                                                                                                 │
│ ❱ 248 │   outputs_map = transform_variable_map(interface.outputs, output_descriptions)                          │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/interface.py:345 in           │
│ transform_variable_map                                                                                          │
│                                                                                                                 │
│ ❱ 345 │   │   │   res[k] = transform_type(v, descriptions.get(k, k))                                            │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/interface.py:350 in           │
│ transform_type                                                                                                  │
│                                                                                                                 │
│ ❱ 350 │   return _interface_models.Variable(type=TypeEngine.to_literal_type(x), description=de                  │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/type_engine.py:826 in         │
│ to_literal_type                                                                                                 │
│                                                                                                                 │
│ ❱  826 │   │   transformer = cls.get_transformer(python_type)                                                   │
│                                                                                                                 │
│ /Users/hud/venvs/house_price_prediction/lib/python3.9/site-packages/flytekit/core/type_engine.py:747 in         │
│ get_transformer                                                                                                 │
│                                                                                                                 │
│ ❱  747 │   │   if python_type in cls._REGISTRY:                                                                 │
│                                                                                                                 │
│ /Users/hud/.pyenv/versions/3.9.17/lib/python3.9/typing.py:757 in __hash__                                       │
│                                                                                                                 │
│ ❱  757 │   │   return hash((self.__origin__, self.__args__))                                                    │
│                                                                                                                 │
│ /Users/hud/.pyenv/versions/3.9.17/lib/python3.9/typing.py:1294 in __hash__                                      │
│                                                                                                                 │
│ ❱ 1294 │   │   return hash((self.__origin__, self.__metadata__))                                                │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: unhashable type: 'list'
Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? … flyteorg/flyte