Error while trying to run the Feast.FeatureStore() function

916 Views Asked by At

I am trying to create a feature store, with the datasource in Snowflake.

The feature_store.yaml file has the following connections:

project: ***rla_feature_repo2***
registry: ***registry.db***
provider: ***local***
offline_store:
    type: ***snowflake.offline***
    account: ***pu65258.australia-east.azure***
    user: *******
    password: *******
    role: *******
    warehouse: *******
    database: *******
batch_engine:
    type: ***snowflake.engine***
    account: ***pu65258.australia-east.azure***
    user: *******
    password: *******
    role: *******
    warehouse: *******
    database: *******
online_store:
    type: ***snowflake.online***
    account: ***pu65258.australia-east.azure***
    user: *******
    password: *******
    role: *******
    warehouse: *******
    database: *******
entity_key_serialization_version: 2

I have created the configuration files and when I try to run fs = FeatureStore(repo_path=".") or even "feast apply", I receive the following error in both cases:

KeyError                                  Traceback (most recent call last)
File ~\Anaconda3\envs\rla\lib\site-packages\feast\importer.py:26, in import_class(module_name, class_name, class_type)
     25 try:
---> 26     module = importlib.import_module(module_name)
     27 except Exception as e:
     28     # The original exception can be anything - either module not found,
     29     # or any other kind of error happening during the module import time.
     30     # So we should include the original error as well in the stack trace.

File ~\Anaconda3\envs\rla\lib\importlib\__init__.py:127, in import_module(name, package)
    126         level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File <frozen importlib._bootstrap>:1030, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:1007, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:986, in _find_and_load_unlocked(name, import_)

File <frozen importlib._bootstrap>:680, in _load_unlocked(spec)

File <frozen importlib._bootstrap_external>:790, in exec_module(self, module)

File <frozen importlib._bootstrap>:228, in _call_with_frames_removed(f, *args, **kwds)

File ~\Anaconda3\envs\rla\lib\site-packages\feast\infra\online_stores\snowflake.py:28, in <module>
     25 from feast.utils import to_naive_utc
---> 28 class SnowflakeOnlineStoreConfig(FeastConfigBaseModel):
     29     """Online store config for Snowflake"""

File ~\Anaconda3\envs\rla\lib\site-packages\feast\infra\online_stores\snowflake.py:35, in SnowflakeOnlineStoreConfig()
     32 """ Online store type selector"""
     34 config_path: Optional[str] = (
---> 35     Path(os.environ["HOME"]) / ".snowsql/config"
     36 ).__str__()
     37 """ Snowflake config path -- absolute path required (Can't use ~)"""

File ~\Anaconda3\envs\rla\lib\os.py:679, in _Environ.__getitem__(self, key)
    677 except KeyError:
    678     # raise KeyError with the original key value
--> 679     raise KeyError(key) from None
    680 return self.decodevalue(value)

KeyError: 'HOME'

The above exception was the direct cause of the following exception:

FeastModuleImportError                    Traceback (most recent call last)
Input In [14], in <cell line: 1>()
----> 1 fs = FeatureStore(repo_path=".")

File ~\Anaconda3\envs\rla\lib\site-packages\feast\usage.py:352, in log_exceptions.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    349 _produce_event(ctx)
    351 if traceback:
--> 352     raise exc.with_traceback(traceback)
    354 raise exc

File ~\Anaconda3\envs\rla\lib\site-packages\feast\usage.py:338, in log_exceptions.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    334 fn_call = FnCall(
    335     id=uuid.uuid4().hex, fn_name=_fn_fullname(func), start=datetime.utcnow()
    336 )
    337 try:
--> 338     return func(*args, **kwargs)
    339 except Exception:
    340     _, exc, traceback = sys.exc_info()

File ~\Anaconda3\envs\rla\lib\site-packages\feast\feature_store.py:162, in FeatureStore.__init__(self, repo_path, config, fs_yaml_file)
    160     self.config = load_repo_config(self.repo_path, fs_yaml_file)
    161 else:
--> 162     self.config = load_repo_config(
    163         self.repo_path, Path(self.repo_path) / "feature_store.yaml"
    164     )
    166 registry_config = self.config.get_registry_config()
    167 if registry_config.registry_type == "sql":

File ~\Anaconda3\envs\rla\lib\site-packages\feast\repo_config.py:499, in load_repo_config(repo_path, fs_yaml_file)
    497 raw_config = yaml.safe_load(os.path.expandvars(f.read()))
    498 try:
--> 499     c = RepoConfig(**raw_config)
    500     c.repo_path = repo_path
    501     return c

File ~\Anaconda3\envs\rla\lib\site-packages\feast\repo_config.py:166, in RepoConfig.__init__(self, **data)
    165 def __init__(self, **data: Any):
--> 166     super().__init__(**data)
    168     self._offline_store = None
    169     if "offline_store" in data:

File ~\Anaconda3\envs\rla\lib\site-packages\pydantic\main.py:340, in pydantic.main.BaseModel.__init__()

File ~\Anaconda3\envs\rla\lib\site-packages\pydantic\main.py:1050, in pydantic.main.validate_model()

File ~\Anaconda3\envs\rla\lib\site-packages\feast\usage.py:352, in log_exceptions.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    349 _produce_event(ctx)
    351 if traceback:
--> 352     raise exc.with_traceback(traceback)
    354 raise exc

File ~\Anaconda3\envs\rla\lib\site-packages\feast\usage.py:338, in log_exceptions.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    334 fn_call = FnCall(
    335     id=uuid.uuid4().hex, fn_name=_fn_fullname(func), start=datetime.utcnow()
    336 )
    337 try:
--> 338     return func(*args, **kwargs)
    339 except Exception:
    340     _, exc, traceback = sys.exc_info()

File ~\Anaconda3\envs\rla\lib\site-packages\feast\repo_config.py:307, in RepoConfig._validate_online_store_config(cls, values)
    305 # Validate the dict to ensure one of the union types match
    306 try:
--> 307     online_config_class = get_online_config_from_type(online_store_type)
    308     online_config_class(**values["online_store"])
    309 except ValidationError as e:

File ~\Anaconda3\envs\rla\lib\site-packages\feast\repo_config.py:469, in get_online_config_from_type(online_store_type)
    466 module_name, online_store_class_type = online_store_type.rsplit(".", 1)
    467 config_class_name = f"{online_store_class_type}Config"
--> 469 return import_class(module_name, config_class_name, config_class_name)

File ~\Anaconda3\envs\rla\lib\site-packages\feast\importer.py:31, in import_class(module_name, class_name, class_type)
     26     module = importlib.import_module(module_name)
     27 except Exception as e:
     28     # The original exception can be anything - either module not found,
     29     # or any other kind of error happening during the module import time.
     30     # So we should include the original error as well in the stack trace.
---> 31     raise FeastModuleImportError(module_name, class_name) from e
     33 # Try getting the class.
     34 try:

**FeastModuleImportError: Could not import module 'feast.infra.online_stores.snowflake' while attempting to load class 'SnowflakeOnlineStoreConfig'**

I am not exactly sure what module do I have to install in python for this or what's the best way to overcome this error. I am using Jupyter Notebook for my project(if that helps). Other classes like FeatureView, Entity etc. seem to be working from the Feast module.

1

There are 1 best solutions below

0
On

This was an error in feast.

See https://github.com/feast-dev/feast/pull/3193