Freezing application-specific dependencies in Python, virtualenv and pip
Make a blank virtualenv.
Try to run your program.
If there is an import error, install the relevant package, then go to (2) again.
You now have a virtualenv with just the packages that are required.  Freeze that.
How can I have a clean virtualenv for my flask application that contains nothing else than the dependencies of application needs?
I am using Ubuntu and I have a Flask application and when I run command pip freeze > requirements.txt the requirements file gets unnecessary files also
This leads to a problem when uploading it on heroku.
How do I resolve this?