Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does python file with packages to install must be called requirements.txt?

I have quick question, becouse I have a weird bug. In my code I create virtual environment for python and then install all packages from file using pip install -r <file name>. When I run it locally everything is ok, when I run it remotely on machine it fails and shows that some package is not installed.

I found out, that when I call file with packages needed requirements.txt everything works fine locally and remotely, problems apprear when I change file name.

My question is then, is there any convention about naming this file? I thought this name is just a tip and a "standard", but it appears then it is more than that.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

From Requirements files topic from python documentation you can find all explanation regarding the use of a file to install items using pip install. You can also check in the User Guide, it mainly need the right file format that can also be found in Requirements File Format.

It’s important to be clear that pip determines package dependencies
using install_requires metadata, not by discovering requirements.txt
files embedded in projects.

So it also works with:

pip install -r my_pacakges.txt
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading