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:
protobuf==3.20.1
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.
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:
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: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
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.
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 stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.