yoshidashingo / langchain-book

MIT License
137 stars 40 forks source link

「6.10 Streamlit Community Cloudにデプロイする」のP151でデプロイに失敗する #10

Open 56nework2022 opened 9 months ago

56nework2022 commented 9 months ago

エラーの説明 第6章のP.151のstreamlitでのdeployに失敗しました。 エラーメッセージは以下の通りです。

スクリーンショット ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app). Traceback: File "/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script exec(code, module.dict) File "/mount/src/streamlit-langchain-app/app.py", line 4, in from dotenv import load_dotenv

書籍の該当箇所 「6.10 Streamlit Community Cloudにデプロイする」のP151です。

書籍の内容以外で実施したこと 正誤表の「パッケージのバージョン固定に関する変更」記載のバージョンでのインストールを実施しております。 (pip install langchain==0.0.292 openai==0.28.0 python-dotenv==1.0.0)

環境 AWS Cloud9

その他

os1ma commented 9 months ago

ご質問ありがとうございます。

from dotenv import load_dotenv

という箇所でエラーがでているようなので、Streamlit Community Cloudの環境で python-dotenv というパッケージが見つからなかった可能性が高そうです。

Streamlit Community Cloudでは、GitHubにアップロードしたrequirements.txtというファイルの内容に従ってパッケージがインストールされます。

以下の2点を確認してみてください。

  1. pip freeze > requirements.txt コマンドでrequirements.txtを作成したか
  2. 作成したrequirements.txtは、GitHubにアップロードしたか

もしも上記の2点を確認しても解決しない場合、GitHubにアップロードしたrequirements.txtをご共有ください。

よろしくお願いします!