Heroku: Python Django deployment suddenly failing - python

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.

Related

Switching python interpreters for Heroku web app [closed]

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.

Heroku is not accepting python-3.9.9 even though it is supported

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.

Not Able To Deploy Django App Because of This Error How To Fix It

ERROR: mysqlclient-1.4.6-cp38-cp38-win32.whl is not a supported wheel on this platform.
! Push rejected, failed to compile Python app.
! Push failed
Try google, "mysql build from wheel".
Find your operating system.
Download.
Try again.
Go to Settings.py
Set DEBUG = 'None'
In case that does not work, refer to this tutorial - https://pythontuts.com/django/posts/301154532665841128/

Heroku Py deployment error 'App not compatible with buildpack'

Other similar issues with answers have not resolved my issue. My deployment method is GitHub and I've not run into an issue with pushing to the repo, however, nothing seems to be able to run. I did set the build pack to Python in the settings of my Heroku app.
For reference, this is my repo I'm using for deployment: https://github.com/EhabJames/MC-Bot-Disc
Full Error:
App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
! Push failed

Error when deploying Django app on Heroku

I am trying to deploy new code at Heroku. The changes I made are simple, no changes to settings or requirements or anything fundamental.
However, when running git push, I get...
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-python.git
=====> Detected Framework: Python
-----> Installing requirements with pip
ImportError: No module named site
! Push rejected, failed to compile Multipack app.
! Push failed
Does anybody have a clue what may be going on here?
I found similar questions already posted, but no clear answer and the proposed solutions didn't work in this case.
Heroku support suggested so far:
$ heroku config:unset PYTHONPATH
$ heroku config:unset PYTHONHOME
Following this, the deployment was possible, but the application stopped working.
By adding those variables back, the application was online again, but deployment would again fail.
Looking for a Solution for two days now - I would appreciate any advice.
requirements.txt file is here.
In this case, the solution to the problem is to remove only the PYTHONHOME variable. The other variable is needed.
The reason was a change in heroku-buildpack-python.
More info here:
https://github.com/heroku/heroku-buildpack-python/issues/457

Categories

Resources