Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 months ago.
Improve this question
The problem
For context:
I have deployed an app with Heroku
I have Python 3.9.2 running locally in VS Code vs Python 3.10.8 running on a Heroku machine
I am currently encountering the problems as mentioned on this thread.
I have found the solution to my problem seems to be switching python interpreters and copying my various packages to that location.
However, there is little documentation on how to do this in Heroku.
Any assistance is really appreciated :)
What I've tried
Given the lack of documentation on the above, I've tried the following...
I found that the Heroku deployment was running on Python 3.10.8 runtime, whereas my local machine had been running 3.9.2.
I then added a runtime.txt in the root of the app's directory in Github that specified to use 3.9.2, but when I try and redeploy the build failed.
Following the Heroku logs, this leads me to:
-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in runtime.txt
! Requested runtime 'cat runtime.txt
python-3.9.2' is not available for this stack (heroku-22).
! For supported versions, see: https://devcenter.heroku.com/articles/python-support
! Push rejected, failed to compile Python app.
! Push failed
I then realise from the logs, that the build package isn't of 3.9.2 isn't supported.
I've then downloaded python 3.11.0 on my local machine (which is supported, as mentioned here).
Deactivated the current virtual environment (using 3.9.2).
Created a new virtual environment.
Rerun the app locally and checked it works.
I've then added the changes to the git repo.
Then, I've tried to deploy on Heroku. I'm now getting:
-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in runtime.txt
! Requested runtime 'cat runtime.txt
python-3.11.0' is not available for this stack (heroku-22).
! For supported versions, see: https://devcenter.heroku.com/articles/python-support
! Push rejected, failed to compile Python app.
! Push failed
I then navigate to the support documentation
I then try and follow the support guidance around 'Checking the buildpack version', as my version of Python is supported, as per the documentation.
I run the command against my CLI which checks which buildpack version I have. I get:
=== [appnamegoeshere] BuildPack URL
heroku/python
So, I have the 'heroku/python' buildpack.
Not sure where to go from here?
Any help is much appreciated :)
The documentation for selecting a runtime says:
To specify a Python runtime, add a runtime.txt file to your app's root directory that declares the exact version number to use:
$ cat runtime.txt
python-3.10.8
The cat runtime part of that is a command that you can run on many systems (Linux, macOS, etc.) to print the contents of a file out. It should not be included in the file.
Your runtime.txt should just contain the appropriate python-x.y.z line. At the moment, on the Heroku-22 stack you can use Python 3.9:
python-3.9.15
Python 3.10:
python-3.10.8
Or Python 3.11:
python-3.11.0
The version you use on your local machine usually just needs to match the major and minor parts: your local Python 3.9.3 should be compatible with Heroku's 3.9.15.
Note that Heroku's list of supported Python versions is updated pretty frequently as new patch releases come out.
Related
I am trying to upload my website to Heroku and I can't get past the (git push heroku master) part. I am following the steps in "Python crash course". I have my python version in my runtime.txt but I keep getting the error
remote: -----> Using Python version specified in runtime.txt
remote: ! Requested runtime () is not available for this stack (heroku-20).
remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support
My runtime.txt has python-3.9.9 in it.
I know python-3.9.9 is supported based on devcenter
Picture of devcenter supported runtimes:
Picture of my runtime code:
My runtime is in the root directory.
Picture of the error I am getting:
I cant push my website because of this and I can't figure it out. Does anyone know what is going on here?
Your runtime.txt does not contain what you think it does. The error says
Requested runtime () is not available for this stack (heroku-20)
The value in those parentheses shows what Heroku sees in your runtime.txt: it's seeing an empty string, not python-3.9.9.
The runtime.txt you show in your screenshot is modified (see the "⬤" in the tab). Save it, commit it, then deploy again.
I am deploying my project with heroku. My Django version number is 3.2.8 and python 3.9.7. It is written on heroku. Heroku supports Python 3.9.7 deployment, but there is an error in my push process. The version above does not support it. What should I do? Thank you for your reply
This is my cmd
my requirements.txt
I haven't used Heroku but I'm curious if this is a problem related to enforced nomenclature on main branch.
A while back I could not push my first commit to a new and empty Git repository if my push command was "git push origin master", it started working after I changed it to "git push origin main" so I suspect this could be the issue you're facing.
Sorry I couldn't ask you before I posted this answer if this is your first push, I do not have enough points to post a comment.
This is due to that Heroku has specific python runtimes.
Visit the link to know : Heroku Supported Runtimes Python
To solve this issue, simply create a runtime.txt file in root folder and add python-3.7.6
I am stuck trying to deploy this Flask App through Heroku. I've researched multiple ways to go about it, but can't seem a way to find it to work. This is what I get when I push to git push heroku master
remote: -----> Building on the Heroku-20 stack
remote: -----> Python app detected
remote: ! Requested runtime (python-) 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.
I've cleared & set up build pack and is currently:
=== wonders141 Buildpack URL
heroku/python
The runtime.txt contains:
python-3.9.1
I'm not sure why the error message doesn't define the python version, so I'm at a lost of how to go about this.
This may be a late answer, but you have to use a newline after python-3.9.6 in runtime.txt
Your python version is not supported on heroku stack 20 - and make sure your python version in runtime is in lower case - see below
I figured how to get past this. I had cleared everything in my requirements.txt and left only the packages I needed. Apparently a lot of unnecessary packages were included.
I had the same problem with Django and I just upgrade python version to One of the supported versions in heroku, then I modified the (runtime.txt) file with the new version python-3.10.7
then I run git's commands like :
git status
git add -A
git commit -m "with any name you want"
git push heroku main --force
I deployed my app this morning all fine, it has been running for months, I have just tried to deploy a change to two HTML template (nothing else has changed in GIT). Heroku is suddenly failing with the below
-----> Python app detected
! Requested runtime (python-3.6.10) is not available for this stack (heroku-18).
! Aborting. More info: https://devcenter.heroku.com/articles/python-support
! Push rejected, failed to compile Python app.
! Push failed
I can't even see anywhere I've specified a python version in Django, not in requirements.txt, but nothing has changed in this respect for months on the apps?
Any ideas greatly appreciated
In the article it links in your error trace it states that they support runtime python-3.6.11 meanwhile it appears your application is still on python-3.6.10. They probably upgraded the version of python they support.
So, I am deploying my first django app to heroku for the first time. I have configured the app locally, pushed it to my remote repository. But when I push the code to my heroku repository, the build fails giving the reason that python 3.6.5 is not available on current stack (heroku-18). It also says here that heroku-18 supports 3.6.6. My simple question is "How do I deploy my python 3.6.5 app on current stack (heroku-18)?"
If you have a runtime.txt file, try changing it to python-3.6.6. 3.6.6 is a maintenance release, so code written for 3.6.5 should run on it fine.
Just try put it in your runtime.txt
python-3.6.4
It's working to me.