Summary
Streamlit is not compatible with Google protobuf version > 3.20. Only works with version 3.19.x
Same issue with all Streamlit version
The latest protobuf is 4.23.3
Steps to reproduce
pip install protobuf
Any version greather than 3
Expected behavior:
Should work with newer version of Google protobuf
Actual behavior:
Got this error:
(streamlit) stpham@C02CD1E8MD6Q pipeline_portal % streamlit run pl_app.py
Traceback (most recent call last):
File “/opt/miniconda3/envs/streamlit/bin/streamlit”, line 5, in
from streamlit.web.cli import main
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/init.py”, line 55, in
from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/delta_generator.py”, line 36, in
from streamlit import config, cursor, env_util, logger, runtime, type_util, util
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/cursor.py”, line 18, in
from streamlit.runtime.scriptrunner import get_script_run_ctx
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/runtime/init.py”, line 16, in
from streamlit.runtime.runtime import Runtime as Runtime
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/runtime/runtime.py”, line 29, in
from streamlit.proto.BackMsg_pb2 import BackMsg
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/proto/BackMsg_pb2.py”, line 14, in
from streamlit.proto import ClientState_pb2 as streamlit_dot_proto_dot_ClientState__pb2
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/proto/ClientState_pb2.py”, line 14, in
from streamlit.proto import WidgetStates_pb2 as streamlit_dot_proto_dot_WidgetStates__pb2
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/proto/WidgetStates_pb2.py”, line 14, in
from streamlit.proto import Common_pb2 as streamlit_dot_proto_dot_Common__pb2
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/streamlit/proto/Common_pb2.py”, line 36, in
_descriptor.FieldDescriptor(
File “/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/google/protobuf/descriptor.py”, line 561, 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 with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
- Downgrade the protobuf package to 3.20.x or lower.
- Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: Changes made on May 6, 2022 | Protocol Buffers Documentation
Debug info
- Streamlit version: 1.22.0
- Python version:3.9.16
- Using Conda?Yes
- OS version: MAC 13.4
- Browser version: Chrome Version 114.0.5735.133
Requirements file
N/A
Links
N/A
Additional information
N/A