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

l5tcr1uw  于 4个月前  发布在  其他
关注(0)|答案(7)|浏览(44)

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)
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 <module>                │
│                                                                                                  │
│ ❱ 1 from .streamlit_ui import render_streamlit_ui                                                │
│   2                                                                                              │
│                                                                                                  │
│ /Users/v0/Projects/ai/MockingBird/control/mkgui/base/ui/streamlit_ui.py:12 in <module>           │
│                                                                                                  │
│     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 = <module 'datetime' from                                                 │ │
│ │                      '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/V… │ │
│ │               Dict = typing.Dict                                                             │ │
│ │             getcwd = <built-in function getcwd>                                              │ │
│ │              Image = <module 'PIL.Image' from                                                │ │
│ │                      '/opt/homebrew/lib/python3.11/site-packages/PIL/Image.py'>              │ │
│ │            inspect = <module 'inspect' from                                                  │ │
│ │                      '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/V… │ │
│ │               List = typing.List                                                             │ │
│ │          mimetypes = <module 'mimetypes' from                                                │ │
│ │                      '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/V… │ │
│ │ NamedTemporaryFile = <function NamedTemporaryFile at 0x10215aa20>                            │ │
│ │               path = <module 'posixpath' (frozen)>                                           │ │
│ │                 pd = <module 'pandas' from                                                   │ │
│ │                      '/opt/homebrew/lib/python3.11/site-packages/pandas/__init__.py'>        │ │
│ │                sys = <module 'sys' (built-in)>                                               │ │
│ │             system = <function system at 0x1015a0720>                                        │ │
│ │               Type = typing.Type                                                             │ │
│ │             unlink = <built-in function unlink>                                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/homebrew/lib/python3.11/site-packages/streamlit/__init__.py:70 in <module>                  │
│                                                                                                  │
│    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 = <module 'click' from                                                │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/click/__init__.py'>     │ │
│ │             _code_util = <module 'streamlit.code_util' from                                  │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/code_util.py… │ │
│ │                _config = <module 'streamlit.config' from                                     │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/config.py'>   │ │
│ │            _contextlib = <module 'contextlib' from                                           │ │
│ │                          '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framewo… │ │
│ │              _env_util = <module 'streamlit.env_util' from                                   │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/env_util.py'> │ │
│ │                _logger = <module 'streamlit.logger' from                                     │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/logger.py'>   │ │
│ │                _LOGGER = <RootLogger root (INFO)>                                            │ │
│ │                 _parse = <module 'urllib.parse' from                                         │ │
│ │                          '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framewo… │ │
│ │           _source_util = <module 'streamlit.source_util' from                                │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/source_util.… │ │
│ │           _string_util = <module 'streamlit.string_util' from                                │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/string_util.… │ │
│ │                   _sys = <module 'sys' (built-in)>                                           │ │
│ │             _threading = <module 'threading' from                                            │ │
│ │                          '/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framewo… │ │
│ │               _version = <function version at 0x11ce245e0>                                   │ │
│ │              beta_util = <module 'streamlit.beta_util' from                                  │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/beta_util.py… │ │
│ │                caching = <module 'streamlit.caching' from                                    │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/caching/__in… │ │
│ │              code_util = <module 'streamlit.code_util' from                                  │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/code_util.py… │ │
│ │                 config = <module 'streamlit.config' from                                     │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/config.py'>   │ │
│ │          config_option = <module 'streamlit.config_option' from                              │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/config_optio… │ │
│ │            config_util = <module 'streamlit.config_util' from                                │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/config_util.… │ │
│ │                 cursor = <module 'streamlit.cursor' from                                     │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/cursor.py'>   │ │
│ │            development = <module 'streamlit.development' from                                │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/development.… │ │
│ │               elements = <module 'streamlit.elements' from                                   │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/elements/__i… │ │
│ │               env_util = <module 'streamlit.env_util' from                                   │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/env_util.py'> │ │
│ │             error_util = <module 'streamlit.error_util' from                                 │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/error_util.p… │ │
│ │                 errors = <module 'streamlit.errors' from                                     │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/errors.py'>   │ │
│ │              file_util = <module 'streamlit.file_util' from                                  │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/file_util.py… │ │
│ │      folder_black_list = <module 'streamlit.folder_black_list' from                          │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/folder_black… │ │
│ │      forward_msg_queue = <module 'streamlit.forward_msg_queue' from                          │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/forward_msg_… │ │
│ │ in_memory_file_manager = <module 'streamlit.in_memory_file_manager' from                     │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/in_memory_fi… │ │
│ │              js_number = <module 'streamlit.js_number' from                                  │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/js_number.py… │ │
│ │         legacy_caching = <module 'streamlit.legacy_caching' from                             │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/legacy_cachi… │ │
│ │                 logger = <module 'streamlit.logger' from                                     │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/logger.py'>   │ │
│ │                  magic = <module 'streamlit.magic' from                                      │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/magic.py'>    │ │
│ │               NoReturn = typing.NoReturn                                                     │ │
│ │                  proto = <module 'streamlit.proto' from                                      │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/proto/__init… │ │
│ │          RootContainer = <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object  │ │
│ │                          at 0x11cae1e50>                                                     │ │
│ │           scriptrunner = <module 'streamlit.scriptrunner' from                               │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/scriptrunner… │ │
│ │                secrets = <module 'streamlit.secrets' from                                    │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/secrets.py'>  │ │
│ │                Secrets = <class 'streamlit.secrets.Secrets'>                                 │ │
│ │       SECRETS_FILE_LOC = '/Users/v0/Projects/ai/MockingBird/.streamlit/secrets.toml'         │ │
│ │           session_data = <module 'streamlit.session_data' from                               │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/session_data… │ │
│ │            source_util = <module 'streamlit.source_util' from                                │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/source_util.… │ │
│ │                  state = <module 'streamlit.state' from                                      │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/state/__init… │ │
│ │                  stats = <module 'streamlit.stats' from                                      │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/stats.py'>    │ │
│ │            string_util = <module 'streamlit.string_util' from                                │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/string_util.… │ │
│ │              type_util = <module 'streamlit.type_util' from                                  │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/type_util.py… │ │
│ │  uploaded_file_manager = <module 'streamlit.uploaded_file_manager' from                      │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/uploaded_fil… │ │
│ │                   util = <module 'streamlit.util' from                                       │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/util.py'>     │ │
│ │                watcher = <module 'streamlit.watcher' from                                    │ │
│ │                          '/opt/homebrew/lib/python3.11/site-packages/streamlit/watcher/__in… │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/homebrew/lib/python3.11/site-packages/streamlit/delta_generator.py:73 in <module>           │
│                                                                                                  │
│    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 = <class 'streamlit.elements.alert.AlertMixin'>                        │ │
│ │            ArrowMixin = <class 'streamlit.elements.arrow.ArrowMixin'>                        │ │
│ │         BalloonsMixin = <class 'streamlit.elements.balloons.BalloonsMixin'>                  │ │
│ │             Block_pb2 = <module 'streamlit.proto.Block_pb2' from                             │ │
│ │                         '/opt/homebrew/lib/python3.11/site-packages/streamlit/proto/Block_p… │ │
│ │            BokehMixin = <class 'streamlit.elements.bokeh_chart.BokehMixin'>                  │ │
│ │           ButtonMixin = <class 'streamlit.elements.button.ButtonMixin'>                      │ │
│ │               caching = <module 'streamlit.caching' from                                     │ │
│ │                         '/opt/homebrew/lib/python3.11/site-packages/streamlit/caching/__ini… │ │
│ │      CameraInputMixin = <class 'streamlit.elements.camera_input.CameraInputMixin'>           │ │
│ │         CheckboxMixin = <class 'streamlit.elements.checkbox.CheckboxMixin'>                  │ │
│ │      ColorPickerMixin = <class 'streamlit.elements.color_picker.ColorPickerMixin'>           │ │
│ │       current_form_id = <function current_form_id at 0x11d814540>                            │ │
│ │                cursor = <module 'streamlit.cursor' from                                      │ │
│ │                         '/opt/homebrew/lib/python3.11/site-packages/streamlit/cursor.py'>    │ │
│ │                Cursor = <class 'streamlit.cursor.Cursor'>                                    │ │
│ │            EmptyMixin = <class 'streamlit.elements.empty.EmptyMixin'>                        │ │
│ │        ExceptionMixin = <class 'streamlit.elements.exception.ExceptionMixin'>                │ │
│ │     FileUploaderMixin = <class 'streamlit.elements.file_uploader.FileUploaderMixin'>         │ │
│ │              FormData = <class 'streamlit.elements.form.FormData'>                           │ │
│ │             FormMixin = <class 'streamlit.elements.form.FormMixin'>                          │ │
│ │        ForwardMsg_pb2 = <module 'streamlit.proto.ForwardMsg_pb2' from                        │ │
│ │                         '/opt/homebrew/lib/python3.11/site-packages/streamlit/proto/Forward… │ │
│ │            get_logger = <function get_logger at 0x11cadda80>                                 │ │
│ │    get_script_run_ctx = <function get_script_run_ctx at 0x11d5c1ee0>                         │ │
│ │         GraphvizMixin = <class 'streamlit.elements.graphviz_chart.GraphvizMixin'>            │ │
│ │             HelpMixin = <class 'streamlit.elements.doc_string.HelpMixin'>                    │ │
│ │           IframeMixin = <class 'streamlit.elements.iframe.IframeMixin'>                      │ │
│ │            ImageMixin = <class 'streamlit.elements.image.ImageMixin'>                        │ │
│ │              Iterable = typing.Iterable                                                      │ │
│ │             JsonMixin = <class 'streamlit.elements.json.JsonMixin'>                          │ │
│ │          LayoutsMixin = <class 'streamlit.elements.layouts.LayoutsMixin'>                    │ │
│ │        legacy_caching = <module 'streamlit.legacy_caching' from                              │ │
│ │                         '/opt/homebrew/lib/python3.11/site-packages/streamlit/legacy_cachin… │ │
│ │              MapMixin = <class 'streamlit.elements.map.MapMixin'>                            │ │
│ │         MarkdownMixin = <class 'streamlit.elements.markdown.MarkdownMixin'>                  │ │
│ │            MediaMixin = <class 'streamlit.elements.media.MediaMixin'>                        │ │
│ │           MetricMixin = <class 'streamlit.elements.metric.MetricMixin'>                      │ │
│ │      MultiSelectMixin = <class 'streamlit.elements.multiselect.MultiSelectMixin'>            │ │
│ │      NoSessionContext = <class 'streamlit.errors.NoSessionContext'>                          │ │
│ │               NoValue = <class 'streamlit.state.widgets.NoValue'>                            │ │
│ │      NumberInputMixin = <class 'streamlit.elements.number_input.NumberInputMixin'>           │ │
│ │              Optional = typing.Optional                                                      │ │
│ │           PlotlyMixin = <class 'streamlit.elements.plotly_chart.PlotlyMixin'>                │ │
│ │         ProgressMixin = <class 'streamlit.elements.progress.ProgressMixin'>                  │ │
│ │           PydeckMixin = <class 'streamlit.elements.deck_gl_json_chart.PydeckMixin'>          │ │
│ │           PyplotMixin = <class 'streamlit.elements.pyplot.PyplotMixin'>                      │ │
│ │            RadioMixin = <class 'streamlit.elements.radio.RadioMixin'>                        │ │
│ │         RootContainer = <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object   │ │
│ │                         at 0x11cae1e50>                                                      │ │
│ │        SelectboxMixin = <class 'streamlit.elements.selectbox.SelectboxMixin'>                │ │
│ │     SelectSliderMixin = <class 'streamlit.elements.select_slider.SelectSliderMixin'>         │ │
│ │           SliderMixin = <class 'streamlit.elements.slider.SliderMixin'>                      │ │
│ │             SnowMixin = <class 'streamlit.elements.snow.SnowMixin'>                          │ │
│ │                    st = <module 'streamlit' from                                             │ │
│ │                         '/opt/homebrew/lib/python3.11/site-packages/streamlit/__init__.py'>  │ │
│ │ StreamlitAPIException = <class 'streamlit.errors.StreamlitAPIException'>                     │ │
│ │             TextMixin = <class 'streamlit.elements.text.TextMixin'>                          │ │
│ │      TextWidgetsMixin = <class 'streamlit.elements.text_widgets.TextWidgetsMixin'>           │ │
│ │      TimeWidgetsMixin = <class 'streamlit.elements.time_widgets.TimeWidgetsMixin'>           │ │
│ │             type_util = <module 'streamlit.type_util' from                                   │ │
│ │                         '/opt/homebrew/lib/python3.11/site-packages/streamlit/type_util.py'> │ │
│ │                  util = <module 'streamlit.util' from                                        │ │
│ │                         '/opt/homebrew/lib/python3.11/site-packages/streamlit/util.py'>      │ │
│ │            WriteMixin = <class 'streamlit.elements.write.WriteMixin'>                        │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /opt/homebrew/lib/python3.11/site-packages/streamlit/elements/arrow_altair.py:25 in <module>     │
│                                                                                                  │
│    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 = <module 'altair' from                                                                 │ │
│ │        '/opt/homebrew/lib/python3.11/site-packages/altair/__init__.py'>                      │ │
│ │ cast = <function cast at 0x100d234c0>                                                        │ │
│ │ date = <class 'datetime.date'>                                                               │ │
│ │ Enum = <enum 'Enum'>                                                                         │ │
│ │   pd = <module 'pandas' from                                                                 │ │
│ │        '/opt/homebrew/lib/python3.11/site-packages/pandas/__init__.py'>                      │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ModuleNotFoundError: No module named 'altair.vegalite.v4'

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

b5buobof

b5buobof1#

i met the same bug, how to fixed

zlwx9yxi

zlwx9yxi2#

应该是默认安装了最新的altair==5.00。降低版本,重新安装altair==4.2.2就可以了。

It should have installed the latest version of altair==5.00 by default. To downgrade the version, simply reinstall altair==4.2.2.

iyr7buue

iyr7buue3#

应该是默认安装了最新的altair==5.00。降低版本,重新安装altair==4.2.2就可以了。

It should have installed the latest version of altair==5.00 by default. To downgrade the version, simply reinstall altair==4.2.2.

v4 install failed on mac m1...

vecaoik1

vecaoik14#

same issue
应该是默认安装了最新的altair==5.00。降低版本,重新安装altair==4.2.2就可以了。
It should have installed the latest version of altair==5.00 by default. To downgrade the version, simply reinstall altair==4.2.2.

v4 install failed on mac m1...

46qrfjad

46qrfjad5#

https://altair-viz.github.io/altair-viz-v4/getting_started/installation.html
不确定你安装失败的原因是什么?上面是altair==4.2.2的文档,可以看看。因为我自己的windows系统,可能无法给到你跟过的帮助了

rhfm7lfc

rhfm7lfc6#

vi /site-packages/streamlit/elements/arrow_altair.py
and change"v4"to "v5"

zazmityj

zazmityj7#

same issue
应该是默认安装了最新的altair==5.00。降低版本,重新安装altair==4.2.2就可以了。
It should have installed the latest version of altair==5.00 by default. To downgrade the version, simply reinstall altair==4.2.2.

v4 install failed on mac m1...

Did you find any solution for this?

相关问题