尽管符合要求,但Heroku仍未找到该模块

时间:2018-06-27 12:26:47

标签: heroku flask build

我在Heroku上部署了Python Flask app,但是由于找不到所需的指定模块flask而无法构建,因此构建失败。错误是:

ModuleNotFoundError: No module named 'flask'

我检查了Raja Simon's answer并使用了$pip freeze > requirements.txt命令。它提供了更长的日志,但最后出现了类似的错误。

以下是日志:

(MyFlaskAppEnv) mike@mike-thinks:~/Programing/Rasa/myflaskapp$ heroku run pip freeze
2018-06-27T11:42:34.000000+00:00 app[api]: Build started by user antoine.compagnie@gmail.com
2018-06-27T11:43:13.411707+00:00 heroku[web.1]: Starting process with command `python app.py 21178`
2018-06-27T11:43:15.837860+00:00 heroku[web.1]: Process exited with status 1
2018-06-27T11:43:15.856692+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-27T11:43:15.772353+00:00 app[web.1]: Traceback (most recent call last):
2018-06-27T11:43:15.772387+00:00 app[web.1]: File "app.py", line 1, in <module>
2018-06-27T11:43:15.772516+00:00 app[web.1]: from flask import Flask, render_template, flash, redirect, url_for, session, request, logging, jsonify
2018-06-27T11:43:15.772564+00:00 app[web.1]: ModuleNotFoundError: No module named 'flask'
2018-06-27T11:43:15.858551+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-27T11:43:09.193489+00:00 app[api]: Deploy 25f77237 by user antoine.compagnie@gmail.com
2018-06-27T11:43:09.193489+00:00 app[api]: Release v4 created by user antoine.compagnie@gmail.com
2018-06-27T11:43:09.000000+00:00 app[api]: Build succeeded
2018-06-27T11:43:09.215426+00:00 app[api]: Scaled to web@1:Free by user antoine.compagnie@gmail.com
2018-06-27T11:43:21.161561+00:00 heroku[web.1]: Starting process with command `python app.py 59367`
2018-06-27T11:43:23.924087+00:00 heroku[web.1]: Process exited with status 1
2018-06-27T11:43:23.940890+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-27T11:43:23.841663+00:00 app[web.1]: Traceback (most recent call last):
2018-06-27T11:43:23.841688+00:00 app[web.1]: File "app.py", line 1, in <module>
2018-06-27T11:43:23.841917+00:00 app[web.1]: from flask import Flask, render_template, flash, redirect, url_for, session, request, logging, jsonify
2018-06-27T11:43:23.841923+00:00 app[web.1]: ModuleNotFoundError: No module named 'flask'
2018-06-27T11:54:43.888837+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rosenberg-moodbot.herokuapp.com request_id=e4428bfb-012c-43dc-a7b4-a67e257a7853 fwd="82.1.184.42" dyno= connect= service= status=503 bytes= protocol=https
2018-06-27T11:54:44.411389+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=rosenberg-moodbot.herokuapp.com request_id=936933c2-d48d-4106-8607-f5e2a45f430a fwd="82.1.184.42" dyno= connect= service= status=503 bytes= protocol=https
2018-06-27T11:54:44.411939+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=rosenberg-moodbot.herokuapp.com request_id=7f49a28a-778b-47aa-9205-92d56a56c73c fwd="82.1.184.42" dyno= connect= service= status=503 bytes= protocol=https
2018-06-27T11:55:07.458967+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rosenberg-moodbot.herokuapp.com request_id=f2d7e020-b654-42da-83f3-631c8a116442 fwd="82.1.184.42" dyno= connect= service= status=503 bytes= protocol=https
2018-06-27T12:03:38.241868+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-27T12:03:42.317464+00:00 heroku[web.1]: Starting process with command `python app.py 28610`
2018-06-27T12:03:44.695629+00:00 heroku[web.1]: Process exited with status 1
2018-06-27T12:03:44.625237+00:00 app[web.1]: Traceback (most recent call last):
2018-06-27T12:03:44.625272+00:00 app[web.1]: File "app.py", line 1, in <module>
2018-06-27T12:03:44.625441+00:00 app[web.1]: from flask import Flask, render_template, flash, redirect, url_for, session, request, logging, jsonify
2018-06-27T12:03:44.625492+00:00 app[web.1]: ModuleNotFoundError: No module named 'flask'
2018-06-27T12:03:44.791879+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-27T12:09:07.960949+00:00 app[api]: Starting process with command `pip freeze` by user antoine.compagnie@gmail.com
2018-06-27T12:09:14.153229+00:00 heroku[run.8725]: State changed from up to complete
2018-06-27T12:09:14.083206+00:00 heroku[run.8725]: Awaiting client
2018-06-27T12:09:14.134697+00:00 heroku[run.8725]: State changed from starting to up
2018-06-27T12:09:14.121827+00:00 heroku[run.8725]: Error R13 (Attach error) -> Failed to attach to process
2018-06-27T12:09:14.127236+00:00 heroku[run.8725]: Process exited with status 128
2018-06-27T12:09:18.023627+00:00 app[api]: Starting process with command `pip freeze` by user antoine.compagnie@gmail.com
2018-06-27T12:09:22.543943+00:00 heroku[run.7995]: Awaiting client
2018-06-27T12:09:22.572262+00:00 heroku[run.7995]: Starting process with command `pip freeze`
2018-06-27T12:09:22.714123+00:00 heroku[run.7995]: State changed from starting to up
2018-06-27T12:09:27.866504+00:00 heroku[run.7995]: Process exited with status 0
2018-06-27T12:09:27.884656+00:00 heroku[run.7995]: State changed from up to complete
2018-06-27T12:10:47.411648+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rosenberg-moodbot.herokuapp.com request_id=865fbea1-bf7b-43a7-82e1-aaa3be505e7b fwd="82.1.184.42" dyno= connect= service= status=503 bytes= protocol=https
2018-06-27T12:11:43.794922+00:00 heroku[run.1331]: Awaiting client
2018-06-27T12:11:43.833108+00:00 heroku[run.1331]: Starting process with command `pip freeze`
2018-06-27T12:11:43.925237+00:00 heroku[run.1331]: State changed from starting to up
2018-06-27T12:11:39.579643+00:00 app[api]: Starting process with command `pip freeze` by user antoine.compagnie@gmail.com
2018-06-27T12:11:48.939978+00:00 heroku[run.1331]: Process exited with status 0
2018-06-27T12:11:48.960226+00:00 heroku[run.1331]: State changed from up to complete
2018-06-27T12:12:30.000000+00:00 app[api]: Build started by user antoine.compagnie@gmail.com
2018-06-27T12:12:49.441456+00:00 app[api]: Deploy 55bbe098 by user antoine.compagnie@gmail.com
2018-06-27T12:12:49.441456+00:00 app[api]: Release v5 created by user antoine.compagnie@gmail.com
2018-06-27T12:12:49.910214+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-27T12:12:49.000000+00:00 app[api]: Build succeeded
2018-06-27T12:12:53.359381+00:00 heroku[web.1]: Starting process with command `python app.py 21411`
2018-06-27T12:12:54.939693+00:00 heroku[web.1]: Process exited with status 1
2018-06-27T12:12:54.900467+00:00 app[web.1]: Traceback (most recent call last):
2018-06-27T12:12:54.900502+00:00 app[web.1]: File "app.py", line 1, in <module>
2018-06-27T12:12:54.900600+00:00 app[web.1]: from flask import Flask, render_template, flash, redirect, url_for, session, request, logging, jsonify
2018-06-27T12:12:54.900606+00:00 app[web.1]: ModuleNotFoundError: No module named 'flask'
2018-06-27T12:12:54.954666+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-27T12:13:01.350585+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=rosenberg-moodbot.herokuapp.com request_id=8a3ae221-135d-4704-bfb3-92cf9339d766 fwd="82.1.184.42" dyno= connect= service= status=503 bytes= protocol=https

这是我的requirements.txt,其中包括flask==1.0.2

这是$heroku run pip freeze的输出,它显示flask似乎不是其中的一部分。

(MyFlaskAppEnv) mike@mike-thinks:~/Programing/Rasa/myflaskapp$ heroku run pip freeze
Running pip freeze on ⬢ rosenberg-moodbot... up, run.9642 (Free)
certifi==2018.4.16
chardet==3.0.4
idna==2.7
pipenv==11.8.2
PySocks==1.6.8
requests==2.19.1
urllib3==1.23
virtualenv==16.0.0
virtualenv-clone==0.3.0
You are using pip version 9.0.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

这是heroku run echo $PATH

的输出
mike@mike-thinks:~/Programing/Rasa/myflaskapp$ heroku run echo $PATH
Running echo /home/mike/bin:/home/mike/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/lib/jvm/java-version/bin:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin:/usr/local/hadoop/bin on ⬢ rosenberg-moodbot... up, run.2949 (Free)
/home/mike/bin:/home/mike/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/lib/jvm/java-version/bin:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin:/usr/local/hadoop/bin

0 个答案:

没有答案