LoginSignup
Bisco_boy
@Bisco_boy

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

linebotを作る際のherokuエラーについて(requirements.txt)

herokuを活用して、Linebotの作成中のプログラミング初心者です。
以下の参考記事①を見ながらコードを書いていますが、エラーが発生し、その対処方法に苦慮しております。
原因と対処方法についてご教示いただけますと幸いです。

参考記事
https://qiita.com/kro/items/67f7510b36945eb9689b
https://qiita.com/takuto_neko_like/items/52c6c52385386544aa62

OS:windows
エディタ:JupyterLab

・エラー内容
「git push heroku master」を実行すると、以下の内容でエラーが返ってきます。
+++++++++
(略)
App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
(中略)
To https://git.heroku.com/<アプリ名>.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/<アプリ名>.git'
+++++++++

また、herokuのactivityを見てみると、以下のエラーが返ってきています。
+++++++++
-----> 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
+++++++++
上記tgzファイルはwindowsでは開けませんでした。

・対応状況
参考記事②では「requirements.txt」が存在していなかったことが原因とのことですが、現在は以下の内容で作成しています。
「requirements.txt」
 flask==1.0.2
 line-bot-sdk==1.16.0
 ※pipでflask,line-bot-sdkをインストールした際のversionを記載
  flask in c:\anaconda\lib\site-packages (1.0.2)
  line-bot-sdk in c:\anaconda\lib\site-packages (1.16.0)

・やってみたこと
「requirements.txt」にpipインストールした際にflask,line-bot-sdk以外のもの(urllib3,certifi等)を一式記載してもエラーになりました

以上、いろいろ調べてみましたが、原因がわからず行き詰っています。
どうぞよろしくお願いいたします。

0

1Answer

Comments

  1. @Bisco_boy

    Questioner
    ありがとうございます。
    コマンドでは「line-bot-test」というフォルダを参照先としており、ここには以下5ファイルを格納しています。
    ・Procfile
    ・requirements.txt
    ・runtime.txt
    ・main.ipynb(Jupyterlabのプログラム)
    ・.ipynb_checkpoints(実行時に自動で作成されたフォルダ。これを削除するとエラーが出ました)

    ですので、リポジトリに追加できていると思います、、
  2. それらのうち少なくともProcfileとrequirements.txtはリポジトリのルートディレクトリに置かれている必要がありますがそこは問題ないですか?
  3. @Bisco_boy

    Questioner
    ありがとうございます。
    見直して解決できました。大変助かりました。

Your answer might help someone💌