添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
神勇威武的水煮肉  ·  Benchmark de ...·  6 月前    · 
乐观的签字笔  ·  Results - OpenURL ...·  6 月前    · 
孤独的炒面  ·  《庆余年 ...·  7 月前    · 
狂野的柳树  ·  MATLAB App ...·  8 月前    · 

I am trying to run streamlit under Ubuntu and get the following error:

streamlit
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/streamlit", line 5, in <module>
    from streamlit.cli import main
  File "/home/ubuntu/.local/lib/python3.8/site-packages/streamlit/__init__.py", line 48, in <module>
    from streamlit.proto.RootContainer_pb2 import RootContainer
  File "/home/ubuntu/.local/lib/python3.8/site-packages/streamlit/proto/RootContainer_pb2.py", line                                                                                                  33, in <module>
    _descriptor.EnumValueDescriptor(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 755, in                                                                                                  __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated wi                                                                                                 th protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and wil                                                                                                 l be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

But I already have protocbuf 4.20.x installed.

Any help is appreciated.
Thanks

I am running into the same problem. According to google doc, there is a need to set an environment variable to make it work.
Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
but there seems to be no place where i can set it.

I encountered the same problem and avoided it by installing the compatible version of protobuf:

pip install 'protobuf~=3.19.0'

To deploy it on Streamlit Cloud, I added a line to requirements.txt:

github.com/whitphx/streamlit-webrtc-example
  • cachetools = ">=4.0"
  • click = ">=7.0"
  • # 1.4 introduced the functionality found in python 3.8's importlib.metadata module
  • importlib-metadata = ">=1.4"
  • numpy = "*"
  • packaging = "*"
  • pandas = ">=0.21.0"
  • pillow = ">=6.2.0"
  • # protobuf version 3.11 is incompatible, see https://github.com/streamlit/streamlit/issues/2234
  • protobuf = ">=3.6.0, !=3.11"
  • pyarrow = "*"
  • pydeck = ">=0.1.dev5"
  • pympler = ">=0.9"
  • python-dateutil = "*"
  • requests = "*"
  • toml = "*"
  • # 5.0 has a fix for etag header: https://github.com/tornadoweb/tornado/issues/2262
  • tornado = ">=5.0"
  • tzlocal = "*"
  • validators = "*"
  • Any updates on this?

    I would love to use streamlit together with google ads api, but since most new versions of goolge APIs require protobuf > 4 it is not possible!

    I tried using the Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
    but this just slows the process way to much to a point where its unusable.

    Please fix so we will be able to use streamlit with newer protobuf versions!

    Bumping this up again. I want to use streamlit with some Google APIs that require newer versions of protobuf so i cant downgrade to 3.20.x

    Any suggestions?

    Unless you absolutely need the very latest versions of these Google libraries, these conflicts are usually easy to resolve. If you run in a clean environment:

    pip install --upgrade streamlit google-ads
    

    You end up with:

    Package                  Version
    ------------------------ -----------
    google-ads               18.0.0
    protobuf                 3.20.0
    streamlit                1.20.0
    ... and of course some more packages
    

    …which is not too bad.

    The problems or conflicts usually start when you mess around in the local dev environment and manually install packages one by one.

    Hey Franky1, thanks for your response.

    I have been running in a clean environment , inside a venv.

    the issue is when i need to install
    streamlit
    google-ads
    google-cloud-language>=2.6

    for the google-cloud-languge, this is not the newest version but the first one that has a new feature i need. This version also creates a conflict between the 3 when it comes to the protobuf version dependency

    Do you have plans to upgrade to work with newer versions of protobuf?
    this is also an open issue on github that seems to get a lot of requests: