python - Python Streamlit nltk 应用程序的 Heroku R10 和 H20 超时错误
问题描述
我遵循教程并花了很多时间尝试在 Heroku 上部署我的 Streamlit Python 应用程序,但无济于事。我的 repo 中有所有必需的文件(据我所知),并进行了更改以指定环境变量 PORT。
就依赖项而言,我有很多包和我担心的 nltk 语料库会导致 R10 启动超时https://devcenter.heroku.com/articles/error-codes#r10-boot-timeout。
我已经将启动时间加倍到 120 秒,但我仍然无处可去。我不知道我是否遗漏了一些明显的东西,并且非常感谢您的任何建议!
Heroku 日志 --tail:
2020-09-01T11:53:24.520334+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run app_GUI.py
2020-09-01T11:53:25.728977+00:00 app[web.1]: setup.sh: 2: setup.sh:
2020-09-01T11:53:25.729063+00:00 app[web.1]: setup.sh: 7: setup.sh:
2020-09-01T11:53:25.729151+00:00 app[web.1]: setup.sh: 14: setup.sh:
2020-09-01T11:53:25.729154+00:00 app[web.1]: 30234
2020-09-01T11:53:28.597500+00:00 app[web.1]:
2020-09-01T11:53:28.597561+00:00 app[web.1]: You can now view your Streamlit app in your browser.
2020-09-01T11:53:28.597619+00:00 app[web.1]:
2020-09-01T11:53:28.597741+00:00 app[web.1]: Network URL: http://172.18.117.54:8501
2020-09-01T11:53:28.597871+00:00 app[web.1]: External URL: http://54.173.40.240:8501
2020-09-01T11:53:28.597945+00:00 app[web.1]:
2020-09-01T11:53:29.231436+00:00 app[web.1]: [nltk_data] Downloading package wordnet to
2020-09-01T11:53:29.231446+00:00 app[web.1]: [nltk_data] /app/.heroku/python/nltk_data... 2020-09-01T11:53:29.255512+00:00 app[web.1]: [nltk_data] Package wordnet is already up-to-date! 2020-09-01T11:55:24.748343+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to
$PORT within 120 seconds of launch
2020-09-01T11:55:24.763008+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-01T11:55:24.831619+00:00 heroku[web.1]: Process exited with status 137
2020-09-01T11:55:24.863525+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-01T12:32:26.530206+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-01T12:32:43.836441+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit
run app_GUI.py` 2020-09-01T12:32:46.574924+00:00 app[web.1]: setup.sh: 2: setup.sh:
2020-09-01T12:32:46.574999+00:00 app[web.1]: setup.sh: 7: setup.sh:
2020-09-01T12:32:46.575113+00:00 app[web.1]: setup.sh: 14: setup.sh:
2020-09-01T12:32:46.575114+00:00 app[web.1]: 52574
2020-09-01T12:32:51.170156+00:00 app[web.1]:
2020-09-01T12:32:51.170606+00:00 app[web.1]: You can now view your Streamlit app in your browser.
2020-09-01T12:32:51.170812+00:00 app[web.1]:
2020-09-01T12:32:51.171140+00:00 app[web.1]: Network URL: http://172.19.104.42:8501
2020-09-01T12:32:51.171347+00:00 app[web.1]: External URL: http://54.158.252.62:8501
2020-09-01T12:32:51.172376+00:00 app[web.1]:
2020-09-01T12:32:52.405826+00:00 app[web.1]: [nltk_data] Downloading package wordnet to
2020-09-01T12:32:52.405838+00:00 app[web.1]: [nltk_data] /app/.heroku/python/nltk_data...
2020-09-01T12:32:52.432605+00:00 app[web.1]: [nltk_data] Package wordnet is already up-to-date!
2020-09-01T12:34:44.432198+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to
$PORT within 120 seconds of launch
2020-09-01T12:34:44.449844+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-01T12:34:44.550792+00:00 heroku[web.1]: Process exited with status 137
2020-09-01T12:34:44.589632+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-01T13:16:47.335672+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-01T13:17:03.737534+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit
run app_GUI.py` 2020-09-01T13:17:05.584275+00:00 app[web.1]: setup.sh: 2: setup.sh:
2020-09-01T13:17:05.584393+00:00 app[web.1]: setup.sh: 7: setup.sh:
2020-09-01T13:17:05.584516+00:00 app[web.1]: setup.sh: 14: setup.sh:
2020-09-01T13:17:05.584518+00:00 app[web.1]: 42849
2020-09-01T13:17:08.947861+00:00 app[web.1]:
2020-09-01T13:17:08.947929+00:00 app[web.1]: You can now view your Streamlit app in your browser.
2020-09-01T13:17:08.948027+00:00 app[web.1]:
2020-09-01T13:17:08.948491+00:00 app[web.1]: Network URL: http://172.16.229.2:8501
2020-09-01T13:17:08.949200+00:00 app[web.1]: External URL: http://3.83.158.216:8501
2020-09-01T13:17:08.949275+00:00 app[web.1]:
2020-09-01T13:17:09.755143+00:00 app[web.1]: [nltk_data] Downloading package wordnet to
2020-09-01T13:17:09.755435+00:00 app[web.1]: [nltk_data] /app/.heroku/python/nltk_data...
2020-09-01T13:17:09.783431+00:00 app[web.1]: [nltk_data] Package wordnet is already up-to-date!
2020-09-01T13:19:04.130442+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to
$PORT within 120 seconds of launch
2020-09-01T13:19:04.153124+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-01T13:19:04.251240+00:00 heroku[web.1]: Process exited with status 137
2020-09-01T13:19:04.297260+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-01T13:42:19.846632+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-01T13:42:36.888856+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit
run app_GUI.py` 2020-09-01T13:42:39.882500+00:00 app[web.1]: setup.sh: 2: setup.sh:
2020-09-01T13:42:39.882621+00:00 app[web.1]: setup.sh: 7: setup.sh:
2020-09-01T13:42:39.882759+00:00 app[web.1]: setup.sh: 14: setup.sh:
2020-09-01T13:42:39.882764+00:00 app[web.1]: 4041
2020-09-01T13:42:46.359593+00:00 app[web.1]:
2020-09-01T13:42:46.362641+00:00 app[web.1]: You can now view your Streamlit app in your browser.
2020-09-01T13:42:46.363612+00:00 app[web.1]:
2020-09-01T13:42:46.363828+00:00 app[web.1]: Network URL: http://172.19.12.26:8501
2020-09-01T13:42:46.364019+00:00 app[web.1]: External URL: http://3.84.245.0:8501
2020-09-01T13:42:46.364328+00:00 app[web.1]:
2020-09-01T13:42:47.638977+00:00 app[web.1]: [nltk_data] Downloading package wordnet to
2020-09-01T13:42:47.638998+00:00 app[web.1]: [nltk_data] /app/.heroku/python/nltk_data...
2020-09-01T13:42:47.675506+00:00 app[web.1]: [nltk_data] Package wordnet is already up-to-date!
2020-09-01T13:44:25.115770+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET
path="/" host=mighty-dawn-80756.herokuapp.com request_id=5e43b824-4cc9-4b86-9d81-a9432127165b
fwd="89.204.224.87" dyno= connect= service= status=503 bytes= protocol=https
2020-09-01T13:44:37.406369+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to
$PORT within 120 seconds of launch
2020-09-01T13:44:37.438826+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-01T13:44:37.634005+00:00 heroku[web.1]: Process exited with status 137
2020-09-01T13:44:37.684485+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-01T13:44:37.686859+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-01T13:44:51.975386+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit
run app_GUI.py` 2020-09-01T13:44:54.309720+00:00 app[web.1]: setup.sh: 2: setup.sh:
2020-09-01T13:44:54.309814+00:00 app[web.1]: setup.sh: 7: setup.sh:
2020-09-01T13:44:54.309942+00:00 app[web.1]: setup.sh: 14: setup.sh:
2020-09-01T13:44:54.309944+00:00 app[web.1]: 42951
2020-09-01T13:44:58.782352+00:00 app[web.1]:
2020-09-01T13:44:58.782521+00:00 app[web.1]: You can now view your Streamlit app in your browser.
2020-09-01T13:44:58.782627+00:00 app[web.1]:
2020-09-01T13:44:58.782811+00:00 app[web.1]: Network URL: http://172.17.156.178:8501
2020-09-01T13:44:58.782988+00:00 app[web.1]: External URL: http://54.81.171.245:8501
2020-09-01T13:44:58.783072+00:00 app[web.1]:
2020-09-01T13:44:59.601857+00:00 app[web.1]: [nltk_data] Downloading package wordnet to
2020-09-01T13:44:59.601875+00:00 app[web.1]: [nltk_data] /app/.heroku/python/nltk_data...
2020-09-01T13:44:59.631770+00:00 app[web.1]: [nltk_data] Package wordnet is already up-to-date!
2020-09-01T13:45:26.131779+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET
path="/" host=mighty-dawn-80756.herokuapp.com request_id=ad8c74f2-3767-435d-b628-10403daf71a3
fwd="89.204.224.87" dyno= connect= service= status=503 bytes= protocol=https
2020-09-01T13:46:01.025283+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET
path="/" host=mighty-dawn-80756.herokuapp.com request_id=25cdd797-c385-4ff2-a59a-582ef632ccf4
fwd="89.204.224.87" dyno= connect= service= status=503 bytes= protocol=https
2020-09-01T13:46:52.219575+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to
$PORT within 120 seconds of launch
2020-09-01T13:46:52.244085+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-01T13:46:52.374195+00:00 heroku[web.1]: Process exited with status 137
2020-09-01T13:46:52.423576+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-01T13:46:53.922418+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"
host=mighty-dawn-80756.herokuapp.com request_id=34dc3d37-de5c-453e-9fe3-058a43585bc6 fwd="89.204.224.87"
dyno= connect= service= status=503 bytes= protocol=https
2020-09-01T13:46:55.119412+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"
host=mighty-dawn-80756.herokuapp.com request_id=0f331c50-7f0a-4122-ba46-957bbc7a73a8 fwd="89.204.224.87"
dyno= connect= service= status=503 bytes= protocol=https
2020-09-01T13:46:55.122942+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET
path="/favicon.ico" host=mighty-dawn-80756.herokuapp.com request_id=2be27373-9ccf-43e5-afc8-aca8d6339d26
fwd="89.204.224.87" dyno= connect= service= status=503 bytes= protocol=https
2020-09-01T14:12:10.847296+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-01T14:12:26.864609+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit
run app_GUI.py` 2020-09-01T14:12:29.334829+00:00 app[web.1]: setup.sh: 2: setup.sh:
2020-09-01T14:12:29.336679+00:00 app[web.1]: setup.sh: 7: setup.sh:
2020-09-01T14:12:29.337364+00:00 app[web.1]: setup.sh: 14: setup.sh:
2020-09-01T14:12:29.337398+00:00 app[web.1]: 34312
2020-09-01T14:12:34.857956+00:00 app[web.1]:
2020-09-01T14:12:34.857996+00:00 app[web.1]: You can now view your Streamlit app in your browser.
2020-09-01T14:12:34.858074+00:00 app[web.1]:
2020-09-01T14:12:34.858183+00:00 app[web.1]: Network URL: http://172.17.236.170:8501
2020-09-01T14:12:34.858431+00:00 app[web.1]: External URL: http://54.175.135.76:8501
2020-09-01T14:12:34.858461+00:00 app[web.1]:
2020-09-01T14:12:36.264287+00:00 app[web.1]: [nltk_data] Downloading package wordnet to
2020-09-01T14:12:36.264532+00:00 app[web.1]: [nltk_data] /app/.heroku/python/nltk_data...
2020-09-01T14:12:36.294373+00:00 app[web.1]: [nltk_data] Package wordnet is already up-to-date!
2020-09-01T14:14:27.237637+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to
$PORT within 120 seconds of launch
2020-09-01T14:14:27.254987+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-01T14:14:27.370891+00:00 heroku[web.1]: Process exited with status 137
2020-09-01T14:14:27.416378+00:00 heroku[web.1]: State changed from starting to crashed
我的 Git 存储库中有以下所有文件:
- 安装程序.sh
mkdir -p ~/.streamlit/
echo "\
[general]\n\
email = \"eval2496@gmail.com\"\n\
" > ~/.streamlit/credentials.toml
echo "\
[server]\n\
headless = true\n\
enableCORS=false\n\
port = $PORT\n\
">~/.streamlit/config.toml
echo $PORT
- 要求.txt
streamlit==0.65.2
pandas==1.0.5
numpy==1.18.4
scikit-learn==0.23.1
nltk==3.5
- 档案
web: sh setup.sh && streamlit run app_GUI.py
- nltk.txt
stopwords
wordnet
- 运行时.txt
python-3.7.5
Value Driver Details.xlsx:app_GUI.py调用的数据
app_GUI.py
import pandas as pd
import re
import string
import nltk
import os
nltk.download('wordnet')
import streamlit as st
from nltk.stem.lancaster import LancasterStemmer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
ON_HEROKU = os.environ.get('ON_HEROKU')
if ON_HEROKU:
# get the heroku port
port = int(os.environ.get('PORT', 17995)) # as per OP comments default is 17995
else:
port = 3000
# functions that run and return output
解决方案
原来我错过了 xlrd 包,但看不到错误。
推荐阅读
- typescript - Vue 3 模板根只需要一个元素。eslint-plugin-vue
- r - How to write NA for missing results in rvest if there was no content in node (within loop) further how to merge variable with results
- android - Firebase Remote Config - cannot find symbol
- reactjs - 当我的状态改变时,我的 useEffect 钩子有没有办法立即重新渲染?
- javascript - Firebase 用户 - 在不重新登录的情况下更新个人资料
- python - 从烧瓶邮件发送的图像无法可视化
- java - 如何在表格中添加行标题?
- linux - 避免 Zsh 重定向提示和无关的“1”输出
- reactjs - React App - createProxyMiddleware 不是一个函数
- google-admin-sdk - 增加邮件配额最快的方法是什么?