There is a variety of reasons why that could happen, including (among others) several kinds of network issues. There must be more relevant details in the output of pip.
Thank you @Goyo and @ineelhere, for helping out. The solution was something different, though. I am mentioning it here in case someone else needs it.
Streamlit 1.16.0 does not work with Python 3.9.7. It only works with Python 3.9.5 (or probably anything above Python 3.9.7). This got tested on multiple machines.