Heroku/python failed to detect set buildpack

14,534

Solution 1

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

Solution 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.

Solution 3

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

Share:
14,534
Admin
Author by

Admin

Updated on June 18, 2022

Comments

  • Admin
    Admin almost 2 years

    I'm a Django newbie, I created an app and want to deploy it using Heroku. However, when I do git push heroku master (I follow Heroku's getting started), this is what I got:

    Counting objects: 36, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (33/33), done.
    Writing objects: 100% (36/36), 19.22 KiB | 0 bytes/s, done.
    Total 36 (delta 3), reused 0 (delta 0)
    remote: Compressing source files... done.
    remote: Building source:
    remote: 
    remote: -----> Failed to detect set buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz
    remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
    remote: 
    remote:  !     Push failed
    remote: Verifying deploy....
    remote: 
    remote: !   Push rejected to dry-waters-63931.
    remote: 
    To https://git.heroku.com/dry-waters-63931.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/dry-waters-63931.git'
    

    My root directory:

    ├── assignment
    ├── household_management (django app)
    ├── templates
    | 
    ├── db.sqlite3
    |
    ├── manage.py
    

    I will be very appreciated if you guys can help. I'm really depressed right now...

  • YAL
    YAL over 7 years
    I have gotten the exact same error but also have done what you suggested.
  • nutella_eater
    nutella_eater over 7 years
    execute "git add . "
  • Chris
    Chris over 7 years
    and commit changes to git!