Get a List of Package Versions Installed

Hi,
Just wondering if itโ€™s possible to obtain a list of the package versions installed when my app is rebooted? I was running into package compatibility issues and just removed the package versions for everything in my requirements.txt file. Now, the app works properly, but I want to go back and specify the versions that it used to finally run properly again.
The log in the Manage App tab in the bottom right is very messy and hard to decipher.
Thanks!

import streamlit as st
import os

result = os.popen('pip list').read()
st.code(result, language=None)