Create a requirements.txt file
Connect Cloud needs a dependency file to know which Python packages to include in a deployment. Any content that has Python code needs a requirements.txt file included in the GitHub repository.
Available methods
Option 1: Write the file yourself
If you know which packages your app or document needs, create a file named requirements.txt and list each package on its own line.
requirements.txt
faicons
shiny
shinywidgets
plotly
pandas
ridgeplot
Then install the packages in your environment:
Terminal
pip install -r requirements.txtOption 2: Use pip freeze
If your app or document already works on your computer, you can save a snapshot of the packages installed in your environment with pip freeze.
Terminal
pip freeze > requirements.txtOption 3: Use uv
If you use uv, there are two ways to create the file.
To save a snapshot of the packages installed in your environment, which is similar to pip freeze, run:
Terminal
uv pip freeze > requirements.txtTo export the packages from a uv project, run this command from the folder that contains your pyproject.toml and uv.lock files:
Terminal
uv export --format requirements-txt --no-hashes --no-emit-project -o requirements.txtThe --no-hashes and --no-emit-project options keep the file to a plain list of packages.
If you deploy with the rsconnect-python command line, you can use a uv.lock or pyproject.toml file directly by naming it with --requirements-file. The other deployment methods need a requirements.txt file.
File location
The requirements.txt file can be in the root folder of the repository or in the folder that contains your primary file.