Can't deply django app Heroku with UnicodeDecodeError

Viewed 24

When I try to push my app to Heroku, the console says

remote: -----> Building on the Heroku-22 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote: Traceback (most recent call last):
remote:   File "/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/vendor/runtime-fixer", line 8, in <module>
remote:     r = f.read().strip()
remote:   File "/usr/lib/python3.10/codecs.py", line 322, in decode
remote:     (result, consumed) = self._buffer_decode(data, self.errors, final)
remote: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
remote: /tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/bin/steps/python: line 9: warning: command substitution: ignored null byte in input
remote: ' is not available for this stack (heroku-22).
remote:  !     For supported versions, see: https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed

How can I fix it?

1 Answers

What Python version do you have in your runtime.txt file?

As per Heroku's documentation:

Supported runtimes

  • python-3.10.7 on all supported stacks (recommended)
  • python-3.9.14 on all supported stacks
  • python-3.8.14 on Heroku-18 and Heroku-20 only
  • python-3.7.14 on Heroku-18 and Heroku-20 only
Related