Why is protobuf forced installed in version 3.20.1?

I’m trying to deploy my project, but i get stuck by the version of one lib : protobuf
I tried everything i could to solve this issue (use other versions of tensorflow, protobuf, streamlit, …), but nothing works as protobuf is finally forced install to version 3.20.1 which is not compatible with tensorflow :

Streamlit 1.13.0 is present. Installing protobuf 3.20.1
Collecting protobuf==3.20.1
  Downloading protobuf-3.20.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 28.9 MB/s eta 0:00:00[2023-04-28 08:39:10.971964] 
Installing collected packages: protobuf
  Attempting uninstall: protobuf
    Found existing installation: protobuf 3.12.4
    Uninstalling protobuf-3.12.4:
      Successfully uninstalled protobuf-3.12.4
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.11.0 requires protobuf<3.20,>=3.9.2, but you have protobuf 3.20.1 which is incompatible.
Successfully installed protobuf-3.20.1

Even if i ask for other versions of protobuf, this one gets installed… Is there a reason? Am I wrong somewhere?

Thanks for your help

What does that exactly mean? Did you try adding protobuf<3.20 to your requirements. file?

You either messed up your dev environment or you have other constraints.

If i am running in a clean environment:

pip install -U streamlit "tensorflow==2.11.0"

… i end up with no conflicts and the following package versions:

Package                      Version
---------------------------- -----------
protobuf                     3.19.6
streamlit                    1.22.0
tensorflow                   2.11.0

If i am running latest versions in a clean environment:

pip install -U streamlit tensorflow

… i also end up with no conflicts and the following package versions:

Package                      Version
---------------------------- -----------
protobuf                     3.20.3
streamlit                    1.22.0
tensorflow                   2.12.0

i tried like this : protobuf==3.20.3
with few different versions… i’ll try as you say

i have no issue in my local environment, the issue comes with streamlit cloud

No, i am quite sure the issue comes with your (non-resolvable) pinned versions in your requirements file…

same behavior… the previous version is uninstalled and 3.20.1 is re-installed automatically

i built the req file from my local env (which works well) with “pip freeze”, so i shouldn’t get this version issue, no?

Using pip freeze is no guarantee and also bad practice.
Share your public github repo link and we can have a look.

ok, what should i do to build this file? only setting manually the libs i know i need?

My repo is here (folder stream_app) : GitHub - Montikore/OCRPyMan

As i already suspected the requirements.txt file is a total mess and the result of using pip freeze :face_with_diagonal_mouth:
Delete it and start from scratch…

Yes and only those you actually import in your application.
For the beginning you can also leave out the version numbers completely and let pip resolve it.

1 Like

my req file is now only this:


and i get same behavior : protobuf-3.20.1 is automatically installed and replace the previous one

Why on earth do you want to manipulate the protobuf version??? Keep your hands off… :grimacing:
This should work:


i tried first without protobuf :slight_smile:

i just tried exactly what you gave, and still same behavior :cry:

Unfortunately, streamlit cloud does force-install protobuf 3.20.1, as you suspected. I think if you pin that version in your requirements.txt, then tensorflow will end up with a version that is compatible with that version of protobuf.

I cloned your repo, added matplotlib to the dependencies, and it seems that all the dependencies install correctly. There are still some issues on the app related the way you are adding folders to PATH, but those are separate for the tensorflow dependency issues, I believe.


This is of course an important piece of information and boundary condition that i was previously unaware of and which is also not documented!? :thinking:

That would mean, one would have to add now actually in each requirements.txt file always protobuf==3.20.1 to avoid such issues!?
And also, Tensorflow 2.9.0 would be the latest version you can use on streamlit cloud!?

Unfortunately, it is currently not documented, which is not good. There have been issues around incompatible-versions of protobuf before which necessitated this to ensure that 3rd-party dependencies don’t end up breaking streamlit for deployed apps. I’m working with our team to try and make sure either we figure out a different way of handling this issue, or adding something to the documentation to make note of this behavior of community cloud.


Now I understand why so many people are having issues with the Google APIs.

1 Like

great! with this, the app is installing without errors, thanks!
but my app doesn’t get out of “the oven” :cry: