Closed liudonghua123 closed 1 year ago
I tried to run the app using the new installed streamlit. But it failed with the following errors.
C:\Users\LIUD~1.H\AppData\Local\Temp>streamlit run my_streamlit.py You can now view your Streamlit app in your browser. Local URL: http://localhost:8501 Network URL: http://113.55.127.140:8501 2023-04-27 15:04:41.541 Uncaught app exception Traceback (most recent call last): File "C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "my_streamlit.py", line 13, in <module> from streamlit.server.server import Server ModuleNotFoundError: No module named 'streamlit.server' 2023-04-27 15:04:43.106 Uncaught app exception Traceback (most recent call last): File "C:\Users\Liu.D.H\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "C:\Users\Liu.D.H\AppData\Local\Temp\my_streamlit.py", line 13, in <module> from streamlit.server.server import Server ModuleNotFoundError: No module named 'streamlit.server' C:\Users\LIUD~1.H\AppData\Local\Temp>streamlit version Streamlit, version 1.21.0 C:\Users\LIUD~1.H\AppData\Local\Temp>python -V Python 3.11.2 C:\Users\LIUD~1.H\AppData\Local\Temp>ver Microsoft Windows [Version 10.0.22621.1555] C:\Users\LIUD~1.H\AppData\Local\Temp>
It seems some code need to update or the app could not run/debug locally due to use some of non-local api.
You can downgrade the version of Streamlit to 1.11.1, which is the version I am using. If you want to use the latest version of Streamlit, you may need to check what the official name for 'streamlit.server' is now.
I need to change the internal imports from
from streamlit.server.server import Server
from streamlit.scriptrunner import get_script_run_ctx as get_report_ctx
to
from streamlit.web.server import Server
from streamlit.runtime.scriptrunner import get_script_run_ctx as get_report_ctx
to make it work on streamlit 1.22.0.
And some other code need change too. See the following warnings/errors.
However, these imports are internal usage, they are not stable for public use. See also https://github.com/streamlit/streamlit/issues/5138, https://github.com/streamlit/streamlit/issues/4562, https://github.com/streamlit/streamlit/issues/4795.
I need to change the internal imports from
from streamlit.server.server import Server from streamlit.scriptrunner import get_script_run_ctx as get_report_ctx
to
from streamlit.web.server import Server from streamlit.runtime.scriptrunner import get_script_run_ctx as get_report_ctx
to make it work on streamlit 1.22.0.
And some other code need change too. See the following warnings/errors.
However, these imports are internal usage, they are not stable for public use. See also streamlit/streamlit#5138, streamlit/streamlit#4562, streamlit/streamlit#4795.
Yes, these imports are for internal use only and are not stable for public usage.
In my project, it is just used to see how many people are currently accessing my project. So, if you don't need this function, you can delete the relevant code.
As for the error you mentioned, I think maybe you have called the function 'set_page_config' twice, or maybe you didn't call it at the beginning?
I tried to run the app using the new installed streamlit. But it failed with the following errors.
It seems some code need to update or the app could not run/debug locally due to use some of non-local api.