Skip to content

Conversation

@mmmavis
Copy link
Member

@mmmavis mmmavis commented Apr 3, 2025

To address the two deployment issues seen on Heroku:

  1. replace runtime.txt with .python-version
  2. add build-requirements.txt for Heroku compatibility
-----> Building on the Heroku-24 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python 3.9.18 specified in runtime.txt
 !     Warning: The runtime.txt file is deprecated.
 !     
 !     The runtime.txt file is deprecated since it has been replaced
 !     by the more widely supported .python-version file:
 !     https://devcenter.heroku.com/changelog-items/3141
 !     
 !     Please delete your runtime.txt file and create a new file named:
 !     .python-version
 !     
 !     Make sure to include the '.' at the start of the filename.
 !     
 !     In the new file, specify your app's Python version without
 !     quotes or a 'python-' prefix. For example:
 !     3.9
 !     
 !     We strongly recommend that you use the major version form
 !     instead of pinning to an exact version, since it will allow
 !     your app to receive Python security updates.
 !     
 !     In the future support for runtime.txt will be removed and
 !     this warning will be made an error.
 !     Warning: Support for Python 3.9 is ending soon!
 !     
 !     Python 3.9 will reach its upstream end-of-life in October 2025,
 !     at which point it will no longer receive security updates:
 !     https://devguide.python.org/versions/#supported-versions
 !     
 !     As such, support for Python 3.9 will be removed from this
 !     buildpack on 7th January 2026.
 !     
 !     Upgrade to a newer Python version as soon as possible, by
 !     changing the version in your runtime.txt file.
 !     
 !     For more information, see:
 !     https://devcenter.heroku.com/articles/python-support#supported-python-versions
 !     Warning: A Python patch update is available!
 !     
 !     Your app is using Python 3.9.18, however, there is a newer
 !     patch release of Python 3.9 available: 3.9.21
 !     
 !     It is important to always use the latest patch version of
 !     Python to keep your app secure.
 !     
 !     Update your runtime.txt file to use the new version.
 !     
 !     We strongly recommend that you do not pin your app to an
 !     exact Python version such as 3.9.18, and instead only specify
 !     the major Python version of 3.9 in your runtime.txt file.
 !     This will allow your app to receive the latest available Python
 !     patch version automatically and prevent this warning.
-----> Discarding cache since:
       - The stack has changed from heroku-20 to heroku-24
       - The Python version has changed from 3.7.8 to 3.9.18
       - The pip version has changed
-----> Installing Python 3.9.18
-----> Installing pip 24.3.1, setuptools 70.3.0 and wheel 0.45.1
-----> Installing SQLite3
-----> Installing dependencies using 'pip install -r requirements.txt'
       Collecting boto3==1.16.26 (from -r requirements.txt (line 7))
         Downloading boto3-1.16.26-py2.py3-none-any.whl.metadata (5.3 kB)
       Collecting botocore==1.19.26 (from -r requirements.txt (line 9))
         Downloading botocore-1.19.26-py2.py3-none-any.whl.metadata (4.7 kB)
       Collecting cachetools==4.1.0 (from -r requirements.txt (line 13))
         Downloading cachetools-4.1.0-py3-none-any.whl.metadata (4.4 kB)
       Collecting certifi==2020.4.5.1 (from -r requirements.txt (line 15))
         Downloading certifi-2020.4.5.1-py2.py3-none-any.whl.metadata (2.7 kB)
       Collecting cffi==1.15.0 (from -r requirements.txt (line 17))
         Downloading cffi-1.15.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.metadata (1.2 kB)
       Collecting chardet==3.0.4 (from -r requirements.txt (line 19))
         Downloading chardet-3.0.4-py2.py3-none-any.whl.metadata (3.2 kB)
       Collecting cryptography==36.0.1 (from -r requirements.txt (line 21))
         Downloading cryptography-36.0.1-cp36-abi3-manylinux_2_24_x86_64.whl.metadata (5.4 kB)
       Collecting defusedxml==0.6.0 (from -r requirements.txt (line 23))
         Downloading defusedxml-0.6.0-py2.py3-none-any.whl.metadata (31 kB)
       Collecting dj-database-url==0.5.0 (from -r requirements.txt (line 25))
         Downloading dj_database_url-0.5.0-py2.py3-none-any.whl.metadata (2.7 kB)
       Collecting django==2.2.13 (from -r requirements.txt (line 27))
         Downloading Django-2.2.13-py3-none-any.whl.metadata (3.6 kB)
       Collecting django-ajax-selects==1.9.1 (from -r requirements.txt (line 36))
         Downloading django_ajax_selects-1.9.1-py3-none-any.whl.metadata (1.3 kB)
       Collecting django-allauth==0.48.0 (from -r requirements.txt (line 38))
         Downloading django-allauth-0.48.0.tar.gz (658 kB)
         Preparing metadata (setup.py): started
         Preparing metadata (setup.py): finished with status 'error'
         error: subprocess-exited-with-error
         
         × python setup.py egg_info did not run successfully.
         │ exit code: 1
         ╰─> [6 lines of output]
             Traceback (most recent call last):
               File "<string>", line 2, in <module>
               File "<pip-setuptools-caller>", line 34, in <module>
               File "/tmp/pip-install-e2e9g0ox/django-allauth_56f6c2b86b644876bbaa7d1b25dab82b/setup.py", line 9, in <module>
                 from setuptools import convert_path, find_packages, setup
             ImportError: cannot import name 'convert_path' from 'setuptools' (/app/.heroku/python/lib/python3.9/site-packages/setuptools/__init__.py)
             [end of output]
         
         note: This error originates from a subprocess, and is likely not a problem with pip.
       error: metadata-generation-failed
       
       × Encountered error while generating package metadata.
       ╰─> See above for output.
       
       note: This is an issue with the package mentioned above, not pip.
       hint: See above for details.
 !     Error: Unable to install dependencies using pip.
 !     
 !     See the log output above for more information.
 !     Push rejected, failed to compile Python app.
 !     Push failed

@mmmavis mmmavis changed the title Replace runtime.txt with .python-version and add build-requirements.txt for Heroku compatibility Address issues seen on Heroku Apr 3, 2025
@mmmavis mmmavis requested a review from danielfmiranda April 3, 2025 20:13
Copy link
Contributor

@danielfmiranda danielfmiranda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mmmavis! LGTM 🙌

@mmmavis mmmavis merged commit 6e79d01 into master Apr 4, 2025
2 checks passed
@mmmavis mmmavis deleted the fix-heroku-issue branch April 4, 2025 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants