Library available (no need to be included in requirements.txt when deploy)

I want to build a web app about machine learning and statistics, and I want to deploy it to Streamlit Cloud. I am wondering which libraries need to be installed in the requirements.txt file and which libraries are already available when deploying a Streamlit app.
Could I write R code in deployed streamlit app?

Many thanks!!!

You should only count on streamlit being installed on Streamlit Community Cloud, but that includes a few different libraries. You can get a sense of what libraries are included with the streamlit here streamlit/lib/setup.py at develop · streamlit/streamlit · GitHub, though this changes depending on which version of streamlit you are using.

In general, if you know you want to use a library (that’s not in the python standard library), it’s a good idea to put it in requirements.txt.

The only libraries I always count on having available with streamlit, personally are:

  • numpy
  • pandas
  • altair
  • requests

Everything else I would put in requirements.txt. Even for those libraries, if you want a specific version, it’s a good idea to put them in requirements.txt.

As for running R code, my intuition is that you could maybe get it working with a lot of work, but that it’s unlikely to work well, and you should try to find a python package that does what you want, instead.