pythonpycharmstreamlit

Debugging a Streamlit application in PyCharm on Windows


I'm trying to setup a way to debug a Streamlit script in PyCharm. I'm on a Win10/64bit machine, working within an virtual environment created with conda. Running the code in the default way with streamlit run main.py works as expected. I have already read several forum posts and most importantly this related question on SO here.

My question is the following: The answer in the question above suggests to change the debug configuration to use Module name instead of Script path and enter streamlit.cli as module. Then in the parameters one should set run main.py as the argument.

Unfortunately this gets me the following error:

No module named streamlit.cli

Where do I find streamlit.cli shouldn't it be installed along with the default pip install of the library? Do I need to install it separately?

Any help is much appreciated!


Solution

  • Stumbled across the (rather simple) answer by accident:

    Simply use the "correct" module name, which in my case was streamlit instead of streamlit.cli. So for debugging I now have the following configuration:

    As I have read in some streamlit forum post: "Works like a (Py)Charm!" :)