如何在Heroku中为应用程序安装依赖项?

时间:2018-06-07 16:26:19

标签: python git heroku dependencies

尝试在Heroku中实现my application时出现以下错误

           ModuleNotFoundError: No module named 'requests'    
           ----------------------------------------   
       Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-sgi6cwh2/ssh-import-id/

 !     Push rejected, failed to compile Python app.   
 !     Push failed

所以我仍然尝试使用heroku runn pip安装请求安装它。但这没什么改变。我尝试在requirements.txt中添加git + https://github.com/requests/requests.git,但它也无效。

但是当你删除需求中的所有内容时,编译就完成了。我受response of maxko87的启发。但突然间,我想我们没有依赖关系,甚至没有gunicorn

我想知道原因是不是文件包含不兼容的C依赖项,不提供“manylinux”轮子将不会安装在Heroku中。如果我不必使用miniconda as they say in the documentation

这是我的requirements.txt文件内容:

gunicorn==19.0.0
absl-py==0.1.11
alabaster==0.7.10
git+https://github.com/apixu/apixu-python.git
APScheduler==3.5.1
#apturl==0.5.2
astor==0.6.2
attrs==18.1.0
Automat==0.6.0
Babel==2.5.3
backports.csv==1.0.5
beautifulsoup4==4.4.1
bleach==1.5.0
blinker==1.3
boto==2.48.0
boto3==1.6.6
botocore==1.9.6
#Brlapi==0.6.4
bz2file==0.98
certifi==2018.4.16
chardet==2.3.0
checkbox-support==0.22
click==6.7
cloudpickle==0.5.2
coloredlogs==10.0
#command-not-found==0.3
ConfigArgParse==0.13.0
constantly==15.1.0
cryptography==1.2.3
cycler==0.10.0
cymem==1.31.2
cytoolz==0.8.2
decorator==4.2.1
#defer==1.0.6
dill==0.2.7.1
docopt==0.6.2
docutils==0.14
elasticsearch==6.2.0
elasticsearch-dsl==6.1.0
#en-core-web-sm==2.0.0
entrypoints==0.2.3
et-xmlfile==1.0.1
fakeredis==0.10.3
fbmessenger==4.3.1
feedparser==5.1.3
Flask==1.0.2
Flask-MySQLdb==0.2.0
future==0.16.0
gast==0.2.0
gensim==3.4.0
gevent==1.3.0
googletrans==2.2.0
graphviz==0.8.3
greenlet==0.4.13
grpcio==1.10.0
guacamole==0.9.2
h5py==2.7.1
html5lib==0.9999999
httplib2==0.9.1
humanfriendly==4.12.1
hyperlink==18.0.0
idna==2.6
imagesize==1.0.0
incremental==17.5.0
ipaddress==1.0.22
ipykernel==4.8.0
ipython==6.2.1
ipython-genutils==0.2.0
ipywidgets==7.1.1
itsdangerous==0.24
jdcal==1.4
jedi==0.11.1
Jinja2==2.10
jmespath==0.9.3
joblib==0.11
jsonpickle==0.9.6
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.2.2
jupyter-console==5.2.0
jupyter-core==4.4.0
Keras==2.1.5
kiwisolver==1.0.1
klein==17.10.0
#language-selector==0.1
#louis==2.6.4
lxml==3.5.0
Mako==1.0.3
Markdown==2.6.11
MarkupSafe==0.23
matplotlib==2.2.0
mistune==0.8.3
#mitie==0.5.0
msgpack-numpy==0.4.1
msgpack-python==0.5.6
murmurhash==0.28.0
mysqlclient==1.3.12
nbconvert==5.3.1
nbformat==4.4.0
nbsphinx==0.3.3
networkx==2.1
nltk==3.2.5
notebook==5.4.0
numpy==1.14.3
oauthlib==1.0.3
#onboard==1.2.0
openpyxl==2.5.3
packaging==17.1
padme==1.1.1
pandas==0.21.0
pandoc==1.0.2
pandocfilters==1.4.2
parso==0.1.1
pathlib==1.0.1
pexpect==4.0.1
pickleshare==0.7.4
Pillow==3.1.2
pipenv==2018.5.18
plac==0.9.6
plainbox==0.25
ply==3.11
preshed==1.0.0
prompt-toolkit==1.0.15
protobuf==3.5.2
ptyprocess==0.5
pyasn1==0.1.9
pycups==1.9.73
pycurl==7.43.0
Pygments==2.2.0
#pygobject==3.20.0
PyJWT==1.3.0
pykwalify==1.6.0
pyparsing==2.0.3
#python-apt==1.1.0b1
python-dateutil==2.6.1
#python-debian==0.1.27
#python-systemd==231
python-telegram-bot==10.1.0
pytz==2017.3
pyxdg==0.25
PyYAML==3.12
pyzmq==16.0.4
qtconsole==4.3.1
rasa-core==0.8.6
rasa-nlu==0.11.5
redis==2.10.6
regex==2017.4.5
reportlab==3.3.0
requests==2.9.1
ruamel.yaml==0.15.37
s3transfer==0.1.13
scikit-learn==0.19.1
scipy==1.0.0
seaborn==0.8.1
Send2Trash==1.4.2
#sessioninstaller==0.0.0
simplegeneric==0.8.1
simplejson==3.14.0
six==1.11.0
sklearn==0.0
slackclient==1.2.1
smart-open==1.5.6
snowballstemmer==1.2.1
spacy==2.0.11
Sphinx==1.7.4
sphinxcontrib-websupport==1.0.1
ssh-import-id==5.5
system-service==0.3
tensorboard==1.6.0
tensorflow==1.6.0
termcolor==1.1.0
terminado==0.8.1
testpath==0.3.1
thinc==6.10.2
toolz==0.9.0
torch==0.3.1
tornado==4.5.3
tqdm==4.23.3
traitlets==4.3.2
Twisted==18.4.0
typing==3.6.4
tzlocal==1.5.1
ubuntu-drivers-common==0.0.0
ufw==0.35
ujson==1.35
unattended-upgrades==0.1
unity-scope-calculator==0.1
unity-scope-chromiumbookmarks==0.1
unity-scope-colourlovers==0.1
unity-scope-devhelp==0.1
unity-scope-firefoxbookmarks==0.1
unity-scope-gdrive==0.7
unity-scope-manpages==0.1
unity-scope-openclipart==0.1
unity-scope-texdoc==0.1
unity-scope-tomboy==0.1
unity-scope-virtualbox==0.1
unity-scope-yelp==0.1
unity-scope-zotero==0.1
urllib3==1.22
usb-creator==0.3.0
virtualenv==16.0.0
virtualenv-clone==0.3.0
wcwidth==0.1.7
webencodings==0.5.1
websocket-client==0.47.0
Werkzeug==0.14.1
widgetsnbextension==3.1.3
wrapt==1.10.11
xdiagnose==3.8.4.1
xkit==0.0.0
xlrd==1.1.0
XlsxWriter==0.7.3
zope.interface==4.5.0
git+https://github.com/requests/requests.git

更新:添加pipefile构建成功后,已部署应用程序但应用程序错误消息

这里是我从Chris的建议中添加的Pipfile,我是这类文件的新手:

[[source]]
url = "https://pypi.python.org/simple"

部署了我的网站但在其上引发了应用程序错误消息。 这是我的日志:

-----> Python app detected

 !     The latest version of Python 3 is python-3.6.5 (you are using python-3.5.2, which is unsupported).

 !     We recommend upgrading by specifying the latest version (python-3.6.5).

       Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> Installing pip
-----> Installing dependencies with Pipenv 11.8.2…
       Installing dependencies from Pipfile…
-----> Discovering process types
       Procfile declares types -> web
-----> Compressing...
       Done: 65.2M
-----> Launching...
       Released v10
       https://moodbotbot.herokuapp.com/ deployed to Heroku

我的Procfile

web: python app.py $PORT

我现在正试图看看我是否不应该在这个Pipfile中添加包。

0 个答案:

没有答案