Heroku Deploy失败:pip._vendor.packaging.requirements.InvalidRequirement:无效的需求,解析错误在"'版本'"

时间:2018-05-29 01:20:58

标签: python python-3.x heroku pip

不确定我的herokuapp无法部署的原因。我正在python 3.6.5上构建一个烧瓶应用程序。我的应用程序在本地服务器上运行完全正常。两个月前应用程序在python 3.6.4上正确部署了应用程序,但我收到了升级到3.6.5的警告。在3.6.4和3.6.5下,我的应用程序因此错误而崩溃。这是heroku-18堆栈的错误吗?我检查了https://github.com/heroku/heroku-buildpack-python/issues/680,但我不知道它对我有多大帮助。我真的很感激一些帮助。谢谢!

Counting objects: 14, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (14/14), 1.69 KiB | 1.69 MiB/s, done.
Total 14 (delta 6), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing python-3.6.5
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:        Invalid requirement: 'Package          Version'
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 92, in __init__
remote:            req = REQUIREMENT.parseString(requirement_string)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1617, in parseString
remote:            raise exc
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1607, in parseString
remote:            loc, tokens = self._parse( instring, 0 )
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1379, in _parseNoCache
remote:            loc,tokens = self.parseImpl( instring, preloc, doActions )
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3376, in parseImpl
remote:            loc, exprtokens = e._parse( instring, loc, doActions )
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1383, in _parseNoCache
remote:            loc,tokens = self.parseImpl( instring, preloc, doActions )
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3164, in parseImpl
remote:            raise ParseException(instring, loc, self.errmsg, self)
remote:        pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 17), (line:1, col:18)
remote:        
remote:        During handling of the above exception, another exception occurred:
remote:        
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/req/req_install.py", line 82, in __init__
remote:            req = Requirement(req)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
remote:            requirement_string[e.loc:e.loc + 8]))
remote:        pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'Version'"
remote:        
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to weborg.

requirements.txt:

Package          Version
---------------- -------
alembic          0.9.9  
click            6.7    
Flask            1.0.2  
Flask-Admin      1.5.1  
Flask-Login      0.4.1  
Flask-Migrate    2.1.1  
Flask-SQLAlchemy 2.3.2  
Flask-Uploads    0.2.1  
Flask-WTF        0.14.2 
gunicorn         19.8.1 
itsdangerous     0.24   
Jinja2           2.10   
Mako             1.0.7  
MarkupSafe       1.0    
phonenumbers     8.9.6  
pip              10.0.1 
psycopg2         2.7.4  
python-dateutil  2.7.3  
python-editor    1.0.3  
setuptools       39.2.0 
six              1.11.0 
SQLAlchemy       1.2.8  
Werkzeug         0.14.1 
wheel            0.31.1 
WTForms          2.1    

runtime.txt

python-3.6.5

procfile

web: flask db upgrade; flask translate compile; gunicorn webapp:app

2 个答案:

答案 0 :(得分:1)

您的requirements.txt格式不正确。

在我看来,您已使用pip list生成了它。您希望在生成pip freeze时使用requirements.txt

答案 1 :(得分:0)

requirements.txt的格式很奇怪。有关正确的格式示例,请参阅https://devcenter.heroku.com/articles/python-pip。详细文档位于https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format