feast icon indicating copy to clipboard operation
feast copied to clipboard

Calling get_historical_features for a feature service with an on_demand_feature_view expects the code locally

Open amonkhouse opened this issue 5 months ago • 1 comments

Expected Behavior

Feature retrieval should not depend on local code. This also causes issues deleting/updating the feature store via the CLI.

Current Behavior

If I register a feature service that uses an on_demand_feature_view and try to get historical features from it I get the following error:

Traceback (most recent call last):
  File "/Users/user/Git/repo/test.py", line 14, in <module>
    features = feature_store.get_historical_features(
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/feast/feature_store.py", line 1171, in get_historical_features
    ) = utils._get_feature_views_to_use(self._registry, self.project, features)
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/feast/utils.py", line 1075, in _get_feature_views_to_use
    fv = registry.get_any_feature_view(name, project, allow_cache)
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/feast/infra/registry/registry.py", line 641, in get_any_feature_view
    return proto_registry_utils.get_any_feature_view(registry_proto, name, project)
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/feast/infra/registry/proto_registry_utils.py", line 92, in wrapper
    value = func(registry_proto, name, project)
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/feast/infra/registry/proto_registry_utils.py", line 145, in get_any_feature_view
    return OnDemandFeatureView.from_proto(on_demand_feature_view)
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/feast/on_demand_feature_view.py", line 393, in from_proto
    transformation = PandasTransformation.from_proto(
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/feast/transformation/pandas_transformation.py", line 150, in from_proto
    udf=dill.loads(user_defined_function_proto.body),
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/dill/_dill.py", line 311, in loads
    return load(file, ignore, **kwds)
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/dill/_dill.py", line 297, in load
    return Unpickler(file, ignore=ignore, **kwds).load()
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/dill/_dill.py", line 452, in load
    obj = StockUnpickler.load(self)
  File "/Users/user/.pyenv/versions/repo/lib/python3.10/site-packages/dill/_dill.py", line 442, in find_class
    return StockUnpickler.find_class(self, module, name)
ModuleNotFoundError: No module named 'feature_services'

I don't get this error if I'm running it from a location that it can find this module, but of course we want to deploy this feature service to the feature store and call it from elsewhere.

Steps to reproduce

I am using a Redshift Offline Source.

feature service code:

merchandisability_feature_store = FeatureService(
    name="merchandisability",
    features=[
        artwork_inquiries_feature_view,
        artwork_metadata_feature_view,
        artist_metadata_feature_view,
        partner_metadata_feature_view,
        purchase_metadata_feature_view,
        artwork_age, <-- on demand feature view
    ],
)

and I try to get features like so:

df = pd.DataFrame.from_dict(
    {"user_id": ["user1"], "event_timestamp": datetime.now()}
)
feature_service = feature_store.get_feature_service("merchandisability")
features = feature_store.get_historical_features(
    features=feature_service,
    entity_df=df,
)

Specifications

  • Version: 0.53.0
  • Platform: MacOS 15.4.1
  • Subsystem:

Possible Solution

🤷

amonkhouse avatar Sep 17 '25 11:09 amonkhouse

This also stops feast ui from working.

OptimeeringBigya avatar Oct 02 '25 13:10 OptimeeringBigya