Iām trying to deploy an app with tensorflow but I keep getting an error from protobuf incompatibility.
Steps to reproduce
Code snippet:
Installing collected packages: protobuf
Attempting uninstall: protobuf
Found existing installation: protobuf 3.19.6
Uninstalling protobuf-3.19.6:
Successfully uninstalled protobuf-3.19.6
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.10.0 requires protobuf<3.20,>=3.9.2, but you have protobuf 3.20.1 which is incompatible.
tensorboard 2.10.1 requires protobuf<3.20,>=3.9.2, but you have protobuf 3.20.1 which is incompatible.
Successfully installed protobuf-3.20.1
Please share a link to your GitHub repo and the contents of your requirements file. Your app isnāt publicly accessible. Moreover, the warning from pip is prescriptive in terms of what you need to do. Install protobuf<3.20,>=3.9.2.
Also, if Streamlit Cloud is installing protobuf-3.20.1, and you continue to see the pip warnings, you can safely ignore them. TensorFlow and TensorBoard can still be imported and work without errors.
Thanks for sharing your requirements file. You can feel free to ignore the warnings generated by pip in this instance. Are you not able to import tensorflow and tensorboard and run them? I was able to import tensorflow inspite of the warnings with:
Side note: fbprophet cannot unfortunately be installed on Community Cloud due to resource limit exhaustion (OOM killed) when the libraryās dependencies are being compiled. The same is true for face-recognition.
In fact, the original error is : ModuleNotFoundError: No module named āstreamlit.scriptrunnerā
And I thought, it was related to TensorFlow installation.
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 562, in _run_script
exec(code, module.__dict__)
File "/app/codex-for-seo/streamlit_app.py", line 3, in <module>
from streamlit_gallery import apps
File "/app/codex-for-seo/streamlit_gallery/apps/__init__.py", line 3, in <module>
from .m2_codex_data import main as m2_codex_data
File "/app/codex-for-seo/streamlit_gallery/apps/m2_codex_data.py", line 26, in <module>
from streamlit.scriptrunner.script_run_context import get_script_run_ctx
Your code in codex-for-seo/streamlit_gallery/apps/m2_codex_data.py seems to be using an internal (subject to change without deprecation!) API that no longer exists in Streamlit 1.13.0.
You have two options.
Either downgrade to an older version that does contain the method, or
The third option (while waiting for the next release) is to install streamlit-nightly and modify your _get_session() method to the following:
from streamlit.runtime.scriptrunner import get_script_run_ctx
import streamlit as st
from streamlit import runtime
def _get_session():
ctx = get_script_run_ctx()
if ctx is None:
return None
session_client = runtime.get_instance().get_client(ctx.session_id)
if session_client is None:
return None
return session_client._session_id
st.write(_get_session())
Iām not sure. Youāll have to go through the codebase to find out as it was an internal API. Until the next release, you could try using the code from my previous reply and streamlit-nightly. Else, youāll have to find the appropriate version yourself either via going through the codebase or trial and error.
But now , I found a new limitation for writing a file directly in my apps Streamlit.
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
exec(code, module.__dict__)
File "/app/codex-for-seo/streamlit_app.py", line 107, in <module>
main()
File "/app/codex-for-seo/streamlit_app.py", line 90, in main
page_selected()
File "/app/codex-for-seo/streamlit_gallery/apps/m2_codex_data.py", line 214, in main
out, error, code, prompt = execute(data, text, datapath)
File "/app/codex-for-seo/streamlit_gallery/apps/m2_codex_data.py", line 95, in execute
with open(scriptpath, "w") as f:
Do you have any suggestions ?
In local mode, I have no issues.