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
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:
For core dev team:
This is because the version of protobuf as a dependency of the streamlit package is specified as protobuf = ">=3.6.0, !=3.11", which allows installing major version-ups that may have breaking changes.
And it actually led to install a new version 4.21.0, which was released 5 hours ago with breaking changes, as described in the page linked from the error message:
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.
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:
I have been working on this as had the same problem. In my case the app uses tensorflow and then there are even more constraints. Finally and after testing a few versions came up with one that works (pure luck), This is what I use and the app works fine in local Docker and also in Cloud Run.
These are the packages that I’m having problems with more specifically. The versions above have already been downgraded, and still no luck.
The conflict is caused by:
The user requested protobuf==3.20.1
google-api-core 2.10.0 depends on protobuf<5.0.0dev and >=3.20.1
google-cloud-secret-manager 2.12.4 depends on protobuf<5.0.0dev and >=3.19.0
googleapis-common-protos 1.58.0 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5