[Fixed]-Heroku/python failed to detect set buildpack

32👍

You need to add a requirements.txt file which contains all of the modules required to run your application.

You can do pip freeze > requirements.txt to freeze all of your modules into a file. I would only recommend doing this if you’re using a virtualenv because otherwise it will add ALL of your modules.

Anyways, just determine exactly what modules your application requires and create a file called requirements.txt and put it in your application directory.

The syntax for a requirements file is as follows:

package name == version #
package name == version #
package name == version #

Note: It is optional to specify a certain version number.

Here is an example requirements file (taken from this tutorial):

Flask==0.11
Jinja2==2.8
gunicorn==19.6.0

Don’t forget to commit your requirements.txt

2👍

Here are steps by steps you can solve the above problem:

  1. Create a requirements.txt file in your app folder.

  2. Run command pip freeze > requirements.txt from the same folder.

  3. Now commit your changes.

    git add .

    git commit -m “requirements added”

    git push heroku master

Here’s the catch, In my case: I did it without adding any modules because pip can also install a dependency from your local codebase automatically. After running the command when i checked my requirement.txt file there were already modules added automatically.

NOTE: If this didn’t happens to you, you can do it manually like Harrison said in his answer.

  1. This step is only if you get an error similar to my case i got an error about conda== version cant be found. As the modules have been added automatically based on my local codebase, Conda version is installed in my local machine thats why it was automatically added in my requirement.txt file. All you have to do is to remove it from the requirements.txt file.

  2. Commit your changes again.

Thought it might help some of you who faced similar errors.

1👍

You just have to add requirements.txt to your main application folder.It contain the package that we work on like django ,flask.

Leave a comment