For the complete documentation index, see llms.txt. This page is also available as Markdown.

requirements.txt

Learn how to generate and configure the requirements.txt file to define essential dependencies for hosting your Python project on Discloud.

🗂️ What is requirements.txt?

The requirements.txt file is essential for Python projects. It lists all dependencies and their versions, ensuring consistent package installation during deployment on Discloud.


🛠️ How to Create requirements.txt

You can create this file using two methods:

1

Create a new text file in your project directory.

2

Name it exactly requirements.txt.

1

Ensure Python and pip are installed (installation guide).

2

Open your terminal in the project directory and run.

pip freeze --user > requirements.txt

This automatically generates a list of all installed packages with their exact versions.


📝 Structure of requirements.txt

Your file should follow these patterns:

  • Basic Package (Latest Version)

    discord.py
  • Version-Specific Package

    discord.py==2.0.0
  • Version Range

    discord.py>=2.0.0
  • GitHub Repository (Unstable Version)

    git+https://github.com/Rapptz/discord.py

Best Practices

  • 🔒 Lock critical dependencies with == for specific versions

  • 🔄 Use >= for packages expecting updates

  • 💻 Always test with exact versions before deployment


📦 Adding Packages

1

Install packages using pip.

2

Update your requirements file.


⚠️ Important Notes

  • Only include packages you actively installed via pip – imported modules don't automatically equal required packages!

  • For GitHub-based packages, include the full repository URL as shown in the examples.

  • If encountering installation issues, verify all package versions are compatible with your Python version.

Last updated