Issue with Protocol Buffers

Hi everyone,

I recently tried to upgrade my app in Streamlit Cloud and got a TypeError (See the error message below).

I was able to temporarily fix the issue by including the following line on my requirements.txt file:


It seems that Google has made some breaking changes to their Cloud Platform to take advantage of Python 4.21+ performance improvements. Streamlit Cloud doesn’t support that version of Python, thus the error.

More info on Google Cloud’s docs and this GitHub thread.

Hope this is helpful.



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:
1 Like

No, this can’t be the reason, there is no python version 4.x.x

The protobuf libraries seems to have some breaking changes. I assume you have to update the whole protobuf toolchain, maybe change the proto definition files and re-generate the protobuf code with the protoc compiler. But since i don’t know what your application is doing, i can only guess.

1 Like

Thanks a lot!!! I’m trying now!

I get the same error when:

import streamlit.cli

with protobuf==4.21.1

Downgrading protobuf to 4.20.1 resolved the issue.

Update: For the above I used streamlit==1.9.0. With streamlit==1.9.1 the protobuf is pinned to 4.20.1.

Yes, this was both a mistake in how Streamlit was specifying its dependencies (not having an upper bound on the major version number of protobuf), and an unexpected release for the library which then got pulled down almost immediately.

The best solution here is to use Streamlit>= 1.9.2, and if you are using Streamlit locally, to build a new virtual environment with a clean install so that any protobuf issues should hopefully not arise in the first place.




Thanks for the heads-up, @Franky1.

I meant to say protobuf 4.21+, not Python 4.21+.