1
0

More than 1 year has passed since last update.

「Requested runtime is not available for this stack」エラーがruntime.txtを削除したら直った話

Posted at

出現したエラー

HerokuにPythonで書いたアプリをデプロイしようとしたら「Requested runtime is not available for this stack」エラーが出て、詰まりました。

情報収集

ネットで検索すると様々な原因と解決策が出てきました

  1. runtime.txtの記法は正しいか?
    python-3.8.12と書いていました。pは小文字で、間にハイフンを付けていますから間違っていないはずです

  2. 指定したバージョンはサポートされているか?
    https://devcenter.heroku.com/articles/python-support#specifying-a-python-version
    を参考にしました。python-3.8.12は対応しているはずです
    (2021年10月当時です。今は変わっているかもしれません)

  3. Python buildpackは最新か?
    https://devcenter.heroku.com/articles/python-support#checking-the-python-buildpack-version
    を参考に一度ビルドパックをクリアしてheroku/pythonを入れ直しましたが、エラーは直りませんでした

  4. Stackを変更してみるのはどうか?
    元々のstackがHeroku-20だったので、Heroku-18に変更してみましたが、やはりエラーは直りませんでした

思わぬ解決策

手詰まりになったので、https://devcenter.heroku.com/articles/python-support#checking-the-python-buildpack-version
を読んでいると、気になる記述がありました

By default, newly created Python apps use the python-3.9.7 runtime

「あれ? これバージョン指定しなくてもよくない?」
試しに僕はruntime.txtを削除してみました

するとデフォルトのpython-3.9.7がインストールされて、無事デプロイ出来ました!
python-3.9.7で動くアプリケーションなら、runtime.txtを削除するのも手ですね

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0