尝试将Flask应用程序部署到AWS Elastic Beanstalk时出错 [英] Error when Trying to Deploy Flask App to AWS Elastic Beanstalk

查看:370
本文介绍了尝试将Flask应用程序部署到AWS Elastic Beanstalk时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用AWS Elastic Beanstalk部署一个Flask应用程序,不幸的是,遇到以下错误。我感到困惑的是,在我的虚拟环境和本地机器的当前版本的点是9.0.1,所以我不知道为什么它正在接受7.1.2。

 命令/opt/python/run/venv/bin/python2.7 -cimport setuptools,tokenize; __ file __ ='/ tmp / pip-build-L32BGc / cffi / setup。 py'; exec(compile(getattr(tokenize,'open',open)(__ file __).read().exc('\r\\\
','\\\
'),__file__,'exec')) install --record /tmp/pip-nO55i_-record/install-record.txt --single-version-external-managed -compile --install-headers / opt / python / run / venv / include / site / python2 .7 / cffi失败,错误代码1在/ tmp / pip-build-L32BGc / cffi
中您正在使用pip版本7.1.2,但是可以使用9.0.1版本。
您应该考虑通过pip install --upgrade pip命令进行升级。
2017-01-29 15:42:34,743错误安装依赖项时出错:返回命令'/ opt / python / run / venv / bin / pip install -r /opt/python/ondeck/app/requirements.txt'非零退出状态1
Traceback(最近一次调用最后一次):

install_dependencies主文件中的/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py,第22行()
文件/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py,第18行,在install_dependencies
check_call('%s install -r%s'%(os.path。加入(APP_VIRTUAL_ENV,'bin','pip'),requirements_file),shell = True)
在check_call中的第541行中的/usr/lib64/python2.7/subprocess.py文件
raise CalledProcessError(retcode,cmd)
CalledProcessError:命令'/ opt / python / run / venv / bin / pip install -r /opt/python/ondeck/app/requirements.txt'返回非零退出状态1 Executor :: NonZeroExitStatus)


解决方案

ersion太旧了。你可以添加 .ebextensions 来解决这个问题。
$ b


  1. add .ebextensions 文件夹放在您的应用程序的根目录下

  2. 在里面放置一个 pip.config 文件,内容是:


    $ $ $

    $ b update_pip
    命令:/ opt / python / run / venv / bin / pip install --upgrade pip




    1. 再次执行eb部署,将会解决。


    I am trying to deploy a Flask application using AWS Elastic Beanstalk and unfortunately have run into the following error. What confuses me is that the current version of pip in my virtual environment and local machine is 9.0.1, so I am not sure why it is picking up 7.1.2.

    Command "/opt/python/run/venv/bin/python2.7 -c "import setuptools, tokenize;__file__='/tmp/pip-build-L32BGc/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nO55i_-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-L32BGc/cffi
      You are using pip version 7.1.2, however version 9.0.1 is available.
      You should consider upgrading via the 'pip install --upgrade pip' command.
      2017-01-29 15:42:34,743 ERROR    Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
      Traceback (most recent call last):
        File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
          install_dependencies()
        File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
          check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
        File "/usr/lib64/python2.7/subprocess.py", line 541, 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 (Executor::NonZeroExitStatus)
    

    解决方案

    This is because the pip version is too old. you can add .ebextensions to solve this.

    1. add .ebextensions folder in the root folder of your app
    2. put a pip.config file inside it, the content is :

    
    commands:
      update_pip:
      command: "/opt/python/run/venv/bin/pip install --upgrade pip"
    

    1. run eb deploy again, it will be resolved.

    这篇关于尝试将Flask应用程序部署到AWS Elastic Beanstalk时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆