Error “Your requirements.txt is invalid” when following tutorial AWS Elastic Beanstalk's Flask tutorial

为君一笑 提交于 2021-02-19 06:23:21

问题


I'm following AWS Elastic Beanstalk's Flask tutorial to deploy the sample application.

Though I get error Your requirements.txt is invalid - in full as below. I google for this error though I get no helpful solution for me.

My requirements.txt file is pasted in below sections. And I'm using Ubuntu Desktop 16.04

As you may succeed the deployment following the tutorial, please share. Thank you.

Error

ERROR: Your requirements.txt is invalid. Snapshot your logs for details.
ERROR: [Instance: i-c78c8f57] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
  File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
  CalledProcessError:
    Command
    '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt'
    returned non-zero exit status 1.
  Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed.
  For more detail, check /var/log/eb-activity.log using console or EB CLI.

INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
WARN: Environment health has transitioned from Pending to Degraded. Command failed on all instances. Initialization completed 45 seconds ago and took 3 minutes.
ERROR: Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

requirements.txt

click==6.6
Flask==0.11.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
pkg-resources==0.0.0
Werkzeug==0.11.10

回答1:


I tested locally and was able to replicate your problem. To get more information about what went wrong on instance I used eb logs to view the logs currently on the EC2 instances. From that I was able to see the full stack in the eb-activity.log

 Collecting pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4))
    Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4)) (from versions: )
  No matching distribution found for pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 4))

I'm not sure where the pkg-resources=0.0.0 came from but it's not a valid package in pip. I was able to delete that line and deploy successfully.

You may want to verify the output of your pip freeze and see if that library is actually there.



来源:https://stackoverflow.com/questions/38893004/error-your-requirements-txt-is-invalid-when-following-tutorial-aws-elastic-bea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!