简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM