IndexError: tuple index out of range when initializing FeatureStore with on-demand feature views on Python 3.11
On-demand features fail on Python 3.11 due to dill serialization issues:
- dill.dumps() fails during FeatureStore initialization → IndexError: tuple index out of range
- dill.loads() fails during feature retrieval → EOFError: Ran out of input
Expected Behavior
FeatureStore should initialize successfully and on-demand features should work.
Current Behavior
FeatureStore.init() fails with IndexError: tuple index out of range when loading on-demand feature views from a SQL registry on Python 3.11. The error occurs during proto serialization of the UDF via dill.dumps().
IndexError: tuple index out of range
File "feast/feature_store.py", line 158, in __init__
self._registry = SqlRegistry(registry_config, self.config.project, None)
File "feast/infra/registry/sql.py", line 272, in __init__
self.cached_registry_proto = self.proto()
File "feast/infra/registry/sql.py", line 866, in process_project
obj_protos = [obj.to_proto() for obj in objs]
File "feast/on_demand_feature_view.py", line 318, in to_proto
self.feature_transformation.to_proto()
File "feast/transformation/base.py", line 95, in to_proto
body=dill.dumps(self.udf, recurse=True),
File "dill/_dill.py", line 420, in dump
StockPickler.dump(self, obj)
File "dill/detect.py", line 148, in nestedglobals
dis.dis(func)
File "dis.py", line 467, in _get_instructions_bytes
argval, argrepr = _get_name_info(arg, get_name)
File "dis.py", line 390, in _get_name_info
argval = get_name(name_index, **extrainfo)
IndexError: tuple index out of range
Steps to reproduce
- Define on-demand feature view:
@on_demand_feature_view(
sources=[base_features],
schema=[Field(name="transformed_feature", dtype=Float64)],
)
def feature_transformations(inputs: pd.DataFrame) -> pd.DataFrame:
df = pd.DataFrame()
df["transformed_feature"] = inputs["base_feature"] / 100
return df
- Apply to SQL registry (PostgreSQL):
feast apply
- Try to initialize FeatureStore on Python 3.11:
from feast import FeatureStore
store = FeatureStore(repo_path="/path/to/repo")
Specifications
- Feast version: 0.54.0
- Python version: 3.11.x
- Registry type: PostgreSQL (SQL registry with psycopg2)
- Offline store: Ray
- OS: Red Hat UBI 9 (Linux)
- dill version: 0.3.8, 0.3.9 (both fail)
https://github.com/uqfoundation/dill/issues/727
The bug is described in this issue: https://github.com/apache/airflow/issues/35307
I discussed this on slack. tl;dr use py 3.10/3.12 https://feastopensource.slack.com/archives/C01M2GYP0UC/p1738614864856059
Issue can be closed, if anything this has to be handled on by dill.