12

I am trying to deploy a project to heroku and I am getting this error:-

Counting objects: 70, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (64/64), done.
Writing objects: 100% (70/70), 17.36 KiB | 0 bytes/s, done.
Total 70 (delta 23), reused 3 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     No default language could be detected for this app.
remote:             HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:             See https://devcenter.heroku.com/articles/buildpacks
remote:
remote:  !     Push failed
remote: Verifying deploy...

If you go to my github project, I have everything required for the heroku project including runtime.txt file but still I am getting this error. I tried changing different python versions supported by Heroku but still same error. Could anyone help me out ?

If I add a buildpack then I am getting the following error

Counting objects: 70, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (64/64), done.
Writing objects: 100% (70/70), 17.36 KiB | 0 bytes/s, done.
Total 70 (delta 23), reused 3 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Failed to detect app matching https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz buildpack
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:

Not sure where I am going wrong ?

python
  • 4,403
  • 13
  • 56
  • 103
  • See also [Heroku Python failed to detect app matching buildpack - Stack Overflow](https://stackoverflow.com/questions/43228526/heroku-python-failed-to-detect-app-matching-buildpack) // [python - Heroku buildpack error while pushing - Stack Overflow](https://stackoverflow.com/questions/49840472/heroku-buildpack-error-while-pushing/49840654#49840654) // [django - Heroku: No default language could be detected for this app for python even with runtime.txt - Stack Overflow](https://stackoverflow.com/questions/44232967/heroku-no-default-language-could-be-detected-for-this-app-for-python-even-with) – user202729 Aug 19 '21 at 01:42
  • Similar questions: for [Go](https://stackoverflow.com/q/46462019/5267751), [Node.js](https://stackoverflow.com/q/43362014/5267751), [Java](https://stackoverflow.com/q/31465992/5267751), [Python](https://stackoverflow.com/q/44232967/5267751) – user202729 Aug 19 '21 at 01:43

3 Answers3

5

A possible solution to this problem can be specifying the buildpack during app creation like :

$ heroku create myapp --buildpack heroku/python

or after app creation like:

$ heroku buildpacks:set heroku/python

Refer Docs : Heroku Docs

The other problem I figured was that I had unnecessary package.json and other files in my django project. I solved it by removing unnecessary files from my app directory.
Since these files were obstructing the automatic detection of buildpack.

Another reason of failed detection could be wrong folder structure of your app. The Procfile and other heroku files should be right at the start of the git directory otherwise your app won't get detected.

Rajan Chauhan
  • 1,378
  • 1
  • 13
  • 32
  • 8
    This gives me `App not compatible with buildpack: https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz ` – markroxor Jun 13 '18 at 10:40
1
  1. in your git bash : echo "python-3.7.0" > runtime.txt (adds runtime.txt file in your root directory with instructions to use python v3.7.0 by Heroku)
  2. git add .
  3. git commit -am "another commit"
  4. git push heroku master
Andrey Kurnikovs
  • 407
  • 1
  • 5
  • 21
0

As for the documentation:

Heroku automatically identifies your app as a Python app if any of the following files are present in its root directory:

  • requirements.txt
  • setup.py
  • Pipfile



You can solve that with pip freeze > requirements.txt, for example.

Jakob
  • 663
  • 7
  • 25