Summary
Running streamlit app in vscode.
Steps to reproduce
Run app using terminal command python -m streamlit run streamlit2.py or streamlit run streamlit2.py both causes an error
Code snippet:
import streamlit as st
st.write("hello world!")
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
to reproduce the error, run python -m streamlit run streamlit2.py or streamlit run streamlit2.py
Code snippet
st.write(“hello world!”)
Expected behavior:
Explain what you expect to happen when you run the code above.
I expect to see A browser window should pop-up showing the newly created Streamlit app. This is the day 2 streamlit challenge I am trying to complete
Actual behavior:
Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.
Error
PS C:\Users\cef19> python -m streamlit run streamlit2.py
Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\runpy.py”, line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File “C:\ProgramData\Anaconda3\lib\runpy.py”, line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File “C:\ProgramData\Anaconda3\lib\runpy.py”, line 111, in get_module_details
import(pkg_name)
File "C:\ProgramData\Anaconda3\lib\site-packages\streamlit_init.py", line 55, in
from streamlit.delta_generator import DeltaGenerator as DeltaGenerator
File “C:\ProgramData\Anaconda3\lib\site-packages\streamlit\delta_generator.py”, line 38, in
from streamlit import config, cursor, env_util, logger, runtime, type_util, util
File “C:\ProgramData\Anaconda3\lib\site-packages\streamlit\cursor.py”, line 18, in
from streamlit.runtime.scriptrunner import get_script_run_ctx
File "C:\ProgramData\Anaconda3\lib\site-packages\streamlit\runtime_init.py", line 16, in
from streamlit.runtime.runtime import Runtime as Runtime
File “C:\ProgramData\Anaconda3\lib\site-packages\streamlit\runtime\runtime.py”, line 26, in
from streamlit.proto.BackMsg_pb2 import BackMsg
File “C:\ProgramData\Anaconda3\lib\site-packages\streamlit\proto\BackMsg_pb2.py”, line 5, in
from google.protobuf.internal import builder as builder
ImportError: cannot import name ‘builder’ from ‘google.protobuf.internal’ (C:\ProgramData\Anaconda3\lib\site-packages\google\protobuf\internal_init.py)
PS C:\Users\cef19>
Error when run with debugging in vs code
Exception has occurred: AttributeError
partially initialized module ‘streamlit’ has no attribute ‘write’ (most likely due to a circular import)
File “C:\Users\cef19\Desktop\ChrisFranklinStreamLit2\streamlit.py”, line 3, in
st.write(‘hello world!’)
File “C:\Users\cef19\Desktop\ChrisFranklinStreamLit2\streamlit.py”, line 1, in
import streamlit as st
Debug info
-
Streamlit version: (get it with
$ streamlit version
) Requirement already satisfied: streamlit in c:\programdata\anaconda3\lib\site-packages (1.16.0) -
Python version: (get it with
$ python --version
) Python 3.8.5 -
Using Conda? PipEnv? PyEnv? Pex? using Conda
-
OS version: PC
-
Browser version: Chrome
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out [this doc]
My requirements file.
altair
pandas
streamlit
numpy
matplotlib
scikit-learn
(App dependencies - Streamlit Docs) and add a requirements file to your app.
Links
-
Link to your GitHub repo:
GitHub - cef1911/streamlit2_chris_franklin -
Link to your deployed app:
https://cef1911-streamlit2-chris-franklin-streamlit2-wxyx83.streamlit.app/
Additional information
Pics
If needed, add any other context about the problem here.
I will try this with pycharm but vscode should work right?