babysor / babysor/MockingBird

web.py: ModuleNotFoundError: No module named 'altair.vegalite.v4'

Open
#893 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
36.9k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

**Summary[问题简述(一句话)]**
A clear and concise description of what the issue is.

Cannot start web.py

**Env & To Reproduce[复现与环境]**
描述你用的环境、代码版本、模型

- MacOS M1
- Python 3.11.3
- pip 23.1.2 from /opt/homebrew/lib/python3.11/site-packages/pip (python 3.11)

```bash
python3 web.py
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/v0/Projects/ai/MockingBird/web.py:17 in launch │
│ │
│ 14 │ # This is required to resolve the opyrator path │
│ 15 │ sys.path.append(os.getcwd()) │
│ 16 │ │
│ ❱ 17 │ from control.mkgui.base.ui.streamlit_ui import launch_ui │
│ 18 │ launch_ui(port) │
│ 19 │
│ 20 if __name__ == "__main__": │
│ │
│ ╭── locals ───╮ │
│ │ port = 8080 │ │
│ ╰─────────────╯ │
│ │
│ /Users/v0/Projects/ai/MockingBird/control/mkgui/base/ui/__init__.py:1 in │
│ │
│ ❱ 1 from .streamlit_ui import render_streamlit_ui │
│ 2 │
│ │
│ /Users/v0/Projects/ai/MockingBird/control/mkgui/base/ui/streamlit_ui.py:12 in │
│ │
│ 9 from PIL import Image │
│ 10 │
│ 11 import pandas as pd │
│ ❱ 12 import streamlit as st │
│ 13 from fastapi.encoders import jsonable_encoder │
│ 14 from loguru import logger │
│ 15 from pydantic import BaseModel, ValidationError, parse_obj_as │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ Any = typing.Any │ │
│ │ Callable = typing.Callable │ │
│ │ datetime = │ │
│ │ Image = │ │
│ │ inspect = │ │
│ │ path = │ │
│ │ pd = │ │
│ │ sys = │ │
│ │ system = │ │
│ │ Type = typing.Type │ │
│ │ unlink = │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /opt/homebrew/lib/python3.11/site-packages/streamlit/__init__.py:70 in │
│ │
│ 67 from streamlit import env_util as _env_util │
│ 68 from streamlit import source_util as _source_util │
│ 69 from streamlit import string_util as _string_util │
│ ❱ 70 from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator │
│ 71 from streamlit.scriptrunner import ( │
│ 72 │ add_script_run_ctx as _add_script_run_ctx, │
│ 73 │ get_script_run_ctx as _get_script_run_ctx, │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ _click = │ │
│ │ _code_util = │ │
│ │ _contextlib = │ │
│ │ _logger = │ │
│ │ _LOGGER = │ │
│ │ _parse = │ │
│ │ _threading = │ │
│ │ beta_util = │ │
│ │ config_option = │ │
│ │ development = │ │
│ │ error_util = │ │
│ │ file_util = │ │
│ │ magic = │ │
│ │ NoReturn = typing.NoReturn │ │
│ │ proto = │ │
│ │ scriptrunner = │ │
│ │ Secrets = │ │
│ │ SECRETS_FILE_LOC = '/Users/v0/Projects/ai/MockingBird/.streamlit/secrets.toml' │ │
│ │ session_data = │ │
│ │ string_util = │ │
│ │ watcher = │
│ │
│ 70 # DataFrame elements come in two flavors: "Legacy" and "Arrow". │
│ 71 # We select between them with the DataFrameElementSelectorMixin. │
│ 72 from streamlit.elements.arrow import ArrowMixin │
│ ❱ 73 from streamlit.elements.arrow_altair import ArrowAltairMixin │
│ 74 from streamlit.elements.arrow_vega_lite import ArrowVegaLiteMixin │
│ 75 from streamlit.elements.legacy_data_frame import LegacyDataFrameMixin │
│ 76 from streamlit.elements.legacy_altair import LegacyAltairMixin │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ AlertMixin = │ │
│ │ ArrowMixin = │ │
│ │ BalloonsMixin = │ │
│ │ Block_pb2 = │ │
│ │ ButtonMixin = │ │
│ │ caching = │ │
│ │ CheckboxMixin = │ │
│ │ ColorPickerMixin = │ │
│ │ current_form_id = │ │
│ │ cursor = │ │
│ │ Cursor = │ │
│ │ EmptyMixin = │ │
│ │ ExceptionMixin = │ │
│ │ FileUploaderMixin = │ │
│ │ FormData = │ │
│ │ FormMixin = │ │
│ │ ForwardMsg_pb2 = │ │
│ │ get_script_run_ctx = │ │
│ │ GraphvizMixin = │ │
│ │ HelpMixin = │ │
│ │ IframeMixin = │ │
│ │ ImageMixin = │ │
│ │ Iterable = typing.Iterable │ │
│ │ JsonMixin = │ │
│ │ LayoutsMixin = │ │
│ │ legacy_caching = │ │
│ │ MarkdownMixin = │ │
│ │ MediaMixin = │ │
│ │ MetricMixin = │ │
│ │ MultiSelectMixin = │ │
│ │ NoSessionContext = │ │
│ │ NoValue = │ │
│ │ NumberInputMixin = │ │
│ │ Optional = typing.Optional │ │
│ │ PlotlyMixin = │ │
│ │ ProgressMixin = │ │
│ │ PydeckMixin = │ │
│ │ PyplotMixin = │ │
│ │ RadioMixin = │ │
│ │ RootContainer = │ │
│ │ SelectboxMixin = │ │
│ │ SelectSliderMixin = │ │
│ │ SliderMixin = │ │
│ │ SnowMixin = │ │
│ │ st = │ │
│ │ StreamlitAPIException = │ │
│ │ TextMixin = │ │
│ │ TextWidgetsMixin = │ │
│ │ TimeWidgetsMixin = │ │
│ │ type_util = │ │
│ │ util = │ │
│ │ WriteMixin = │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /opt/homebrew/lib/python3.11/site-packages/streamlit/elements/arrow_altair.py:25 in │
│ │
│ 22 │
│ 23 import altair as alt │
│ 24 import pandas as pd │
│ ❱ 25 from altair.vegalite.v4.api import Chart │
│ 26 │
│ 27 import streamlit │
│ 28 import streamlit.elements.arrow_vega_lite as arrow_vega_lite │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ alt = │ │
│ │ cast = │ │
│ │ date = │ │
│ │ Enum = │ │
│ │ pd = │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ModuleNotFoundError: No module named 'altair.vegalite.v4'
```

**Screenshots[截图(如有)]**
If applicable, add screenshots to help

image

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running `python3 web.py` in the reported Python 3.11 environment and follow the traceback through `web.py`, `control/mkgui/base/ui/__init__.py`, and `control/mkgui/base/ui/streamlit_ui.py`. Check how the Streamlit and Altair dependencies are declared and imported; done means the web UI starts without the reported ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, streamlit
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.