Regarding the python pip libraries, this is relatively simple.
All imports that do not belong to the Python standard library and that you use in your python program with
import must be entered in the
There is also a python tool called pipreqs that scans the python scripts for non-standard
import modules and writes them to a
But be careful: Sometimes the import modules are named differently than the package name you want to install.
import cv2 versus
pip install opencv-python-headless
There is no quick answer for the dependencies to be entered in
packages.txt. To my knowledge, there is no tool for that either. Most python pip packages do not need additional
apt install packages.
If they do, only helps: I look in the documentation of the python libraries, usually there is described which external libraries are required as prerequisites.
For corresponding error messages you can also google, but not everything you find e.g. on stackoverflow is correct and up to date. A lot of information is outdated.
Also, I usually test my streamlit app locally first in a Docker container, which is very similar to the streamlit sharing runtime. If there are no error messages anymore and the streamlit app works, the deployment to streamlit sharing usually works as well.
You can also find the corresponding Docker files in my cloned github repo.