Skip to content

'feast.ui_server' is not a package #4241

Closed

Description

@mascai

Expected Behavior

feast ui command is starting without errors

Current Behavior

feast ui --host 127.0.0.1 --port 8889
/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/feast/ui_server.py:45: DeprecationWarning: 
        on_event is deprecated, use lifespan event handlers instead.

        Read more about it in the
        [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/).
        
  @app.on_event("shutdown")
/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/fastapi/applications.py:4495: DeprecationWarning: 
        on_event is deprecated, use lifespan event handlers instead.

        Read more about it in the
        [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/).
        
  return self.router.on_event(event_type)
Traceback (most recent call last):
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/bin/feast", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/feast/cli.py", line 172, in ui
    store.serve_ui(
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/feast/feature_store.py", line 2494, in serve_ui
    ui_server.start_server(
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/feast/ui_server.py", line 105, in start_server
    app = get_app(
          ^^^^^^^^
  File "/Users/aamoskalenko/0_root_folder/02_dev/35_feast_ui/venv/lib/python3.11/site-packages/feast/ui_server.py", line 54, in get_app
    ui_dir_ref = importlib_resources.files(__name__) / "ui/build/"
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/resources/_common.py", line 22, in files
    return from_package(get_package(package))
                        ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/resources/_common.py", line 55, in get_package
    raise TypeError(f'{package!r} is not a package')
TypeError: 'feast.ui_server' is not a package

Steps to reproduce

pip install feast==0.38.0
feast init test_ui # created a project
cd test_ui/feature_repo
feast apply -- OK
feast serve -p 8008 # started feast server 127.0.0.1:8008 -- OK

#in the same folder
feast ui --host 127.0.0.1 --port 8009 # I was trying different ports 8008, 8888 etc -- ERROR

Specifications

  • Version: feast==0.38.0 , python3.11
  • Platform: MacOs
  • Subsystem:

Possible Solution

Activity

  1. privatedumbo commented on May 31, 2024

    @privatedumbo
    Contributor

    This happened to me to. The problem is related to importlib_resources.

    Problem: this does not work with importlib.resources
    Solution: install importlib-resources

    To validate this, you can run and it should work. I can PR:

    from unittest import mock
    import importlib_resources
    
    
    with mock.patch("feast.ui_server.importlib_resources", new=importlib_resources):
            store = FeatureStore()
            store.serve_ui(
                host=host,
                port=port,
                get_registry_dump=registry_dump,
                registry_ttl_sec=registry_ttl_sec,
                root_path=root_path,
            )
  2. shuchu commented on May 31, 2024

    @shuchu
    Collaborator

    The importlib of Python involves many changes and deprecations in newer Python versions. I would prefer to modify the code and catch the latest changes in importlib.resources

  3. privatedumbo commented on May 31, 2024

    @privatedumbo
    Contributor

    So you suggest fixing this using the built-in one, instead of installing importlib-resources?

  4. tokoko commented on May 31, 2024

    @tokoko
    Collaborator

    I think I broke this, sorry about that :). changing importlib_resources.files(__name__) with importlib_resources.files('feast') should be a fix if I'm not mistaken. I was for some reason still not able to start the ui server with the change applied, but it seemed to fix the is not a package error. If anyone can verify it, would be a great help...

  5. privatedumbo commented on May 31, 2024

    @privatedumbo
    Contributor

    v0.38.0
    v0.37.1

    For what I see, the difference is using the builtin vs the library. Not the package name

  6. tokoko commented on May 31, 2024

    @tokoko
    Collaborator

    Yes, I made the change in #4109. The difference apparently is that files method in library expects anchor file path as a first parameter, while the same method in built-in expects a package name. I thought there were supposed to be drop-in replacements and missed that...

  7. privatedumbo commented on May 31, 2024

    @privatedumbo
    Contributor

    Yes, should be TBH. I can PR this tomorrow if it helps.
    Option A) we re-install the lib
    Option B) we fix it using the built-in if possible

    WDYT?

  8. tokoko commented on May 31, 2024

    @tokoko
    Collaborator

    yup, I'd prefer fixing it with built-in if possible. importlib libraries are pretty popular and have caused diamond dependency problems before... so if there's a way to not depend on them, that would be a plus. thanks a lot

  9. privatedumbo commented on May 31, 2024

    @privatedumbo
    Contributor

    Good, agreed. Will come back tomorrow for this. Thanks for the ping-pong 🏓

  10. shuchu commented on May 31, 2024

    @shuchu
    Collaborator

    So you suggest fixing this using the built-in one, instead of installing importlib-resources?

    yes, the Python built-in one is preferred as the discussion concluded.

  11. privatedumbo commented on Jun 1, 2024

    @privatedumbo
    Contributor

    PR raised here:
    #4248

  12. Annamalaisaravanan commented on Jul 2, 2024

    @Annamalaisaravanan

    Follow this Video, This helped me a lot to crack and overcome this error: https://www.youtube.com/watch?v=rBJvW3AjmsM

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions