Run streamlit from PyCharm

Hey @schilli,

This is a bit of a fun story. We actually didn’t realize there was a pretty large group of people (mostly PyCharm and VSCode users) running streamlit via python -m streamlit.cli <command>. This method was discovered by the community and seems to have spread through the StackOverflow post that you linked, but internally we never really considered it a “supported” method (it’s undocumented so isn’t considered part of our public API. It just so happens that you used to be able to run the submodule to get functionality equivalent to using streamlit run <command>).

A very similar and equivalent way of invoking streamlit that is supported (so has guarantees to not be broken in the future) is to simply run:

python -m streamlit <command>

instead. Alternatively, another way of running streamlit from PyCharm is described here: Version 1.5.0 - #11 by tim

We’re discussing this internally since it is unfortunate that we inadvertently broke some people’s dev envs, and while a decision hasn’t been finalized, it sounds like we’ll likely keep things as-is (but improve the error message / add official documentation for setting up Streamlit with PyCharm/VSCode) since

  • it feels a bit weird adding official support for a way of invoking streamlit that we never intended to officially support (my guess is that that particular file is only runnable because it made it easier to build/debug when streamlit was first being built, and we just forgot to remove those lines)
  • it’s not too much effort to just remove the .cli so that streamlit is now being started using a supported method
4 Likes