githubEdit

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.


πŸ“ Structure of requirements.txt

Your file should follow these patterns:

circle-info

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