Automatically create requirements.txt
You can use the following code to generate a requirements.txt file:
pip install pipreqspipreqs /path/to/project
more info related to pipreqs can be found here.
Sometimes you come across
pip freeze, but this saves all packages in the environment including those that you don't use in your current project.
In my case, I use Anaconda, so running the following command from conda terminal inside my environment solved it, and created this
requirements.txt file for me automatically:
conda list -e > requirements.txt
This was taken from this Github link pratos/condaenv.txt
If an error been seen, and you are using anaconda, try to use the
conda env export > <environment-name>.yml
For other person to use the environment or if you are creating a new enviroment on another machine:
conda env create -f <environment-name>.yml