Installing Python packages with requirements.txt

Last updated: 8 November 2026

Your bot can use any package from PyPI, for example pyTelegramBotAPI, aiogram, requests or python-dotenv.

Option 1: requirements.txt (recommended)

Add a requirements.txt file to your bot folder, one package per line:

pyTelegramBotAPI==4.21.0
requests
python-dotenv

Then open Manage Bots → Dependencies and press Install requirements. You can also upload the file there with Upload. The bot restarts by itself when the install finishes.

Option 2: install a single package

In Dependencies, type a package name and press Install. It is also added to your requirements.txt, so it is installed again on future deploys.

Advertisement

Automatic detection

If your bot has no requirements.txt when it is first deployed, the server reads the imports in bot.py and installs the matching packages. This guesses well for common libraries, but a requirements.txt is more reliable.

If a package is missing

An error like ModuleNotFoundError: No module named 'requests' in the Errors log means the package is not installed. Add it to requirements.txt and install it.

Installing can take 10–30 seconds. Very large packages (for example machine-learning libraries) may not fit in the 256 MB memory limit.

Next guide Reading bot logs and fixing common errors

Advertisement