Streamlit is not compatible with latest Google protobuf


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
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
File โ€œ/opt/miniconda3/envs/streamlit/lib/python3.9/site-packages/google/protobuf/descriptor.pyโ€, line 561, in new
TypeError: Descriptors cannot not be created directly.
If this call came from a 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:

  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 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




Additional information


You are not using the latest version of streamlitโ€ฆ

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.