1

Heroku will not push my Python version for my Django app and I can't figure out why... I upgraded my python from 3.8.7 to 3.10.2 and reflected this within the runtime.txt file, and the changes are clearly added, but this isn't seeming to work.

From heroku's Python Support:

Supported runtimes
python-3.10.2 on all supported stacks
C:\Users\New User\Downloads\django-modal-ajax-crud-main\django-modal-ajax-crud-main>git push heroku main
Enumerating objects: 191, done.
Counting objects: 100% (191/191), done.
Delta compression using up to 4 threads
Compressing objects: 100% (173/173), done.
Writing objects: 100% (191/191), 72.21 MiB | 1.24 MiB/s, done.
Total 191 (delta 35), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote:  !     Requested runtime ("python-3.10.2") is not available for this stack (heroku-20).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to whispering-oasis-59527.
remote:
To https://git.heroku.com/whispering-oasis-59527.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/whispering-oasis-59527.git'
torek
  • 448,244
  • 59
  • 642
  • 775
RCarmody
  • 712
  • 1
  • 12
  • 29
  • I'd open a Heroku support ticket. That seems like a bug. – schillingt Jan 25 '22 at 15:44
  • Is your `runtime.txt` UTF-8 encoded? – ChrisGPT was on strike Jan 25 '22 at 15:48
  • However it's encoded, heroku is picking up the right request because it literally says `Requested runtime ("python-3.10.2")` in the error. Side note: the tag [tag:git] is inapplicable here. You're using Git to *store your repository* and to *ask Heroku to build* but Git isn't involved in producing any of the errors you see here: it's just relaying stuff *from Heroku*. – torek Jan 26 '22 at 02:49
  • @RCarmody, also, what line endings does that file use? – ChrisGPT was on strike Jan 27 '22 at 16:23
  • I had something similar, I had to use the following command to debug it a bit more. It's not an answer, but maybe it can help you get closer? Note: I had this error as a result of my collect static phase. heroku config:set DEBUG_COLLECTSTATIC=1 – Jazzthedog woofwoof Feb 07 '22 at 03:20

1 Answers1

0

I really deployed with 3.10.2 now, so it's available

And so, You question seems to have a false error that is explained in the end of you output

Requested runtime ("python-3.10.2") is not available for this stack (heroku-20).
...
.. (pre-receive hook declined)

docker documentaion says:

The runtime.txt format is case-sensitive and must not include spaces. You must also specify all three version number components (major, minor, and patch) in runtime.txt.

If you don’t follow this format, your app will fail to deploy.

so make sure no white spaces or new lines, and always keep track of supported runtimes


Additionally

You could remove runtime.txt,

app.json should have "image": "heroku/python" with no version or python in keywords,

then install with default version curently 3.9.10,

and then you could update with runtime.txt


First of All: make sure your app is running properly on local machine

this could also to be a dependency error like this first comment on this answer

Your app and build dependencies should be functional when deploying