python - AWS Elastic Beanstalk 无法使用requirements.txt 安装Python 包 - Firebase-Admin

标签 python django firebase google-cloud-firestore amazon-elastic-beanstalk

我搜索过类似的问题,但没有答案解决我的问题。我正在尝试使用 pip 安装 firebase-admin。本地一切工作正常,但是当我推送到 aws elastic beanstalk 时,它会给出以下错误当我删除 firebase-admin 及其依赖项时,一切工作正常。我认为安装 grpcio 时可能会出现错误,但不完全确定,并且 firebase 需要安装它才能工作。一些答案说 firebase-admin 是动态的,而 aws else 不支持这一点。我想知道这个问题是否有解决方案,以便我可以安装 firebase。谢谢

2020-06-21 04:13:35    INFO    Environment update is starting.      
2020-06-21 04:13:40    INFO    Deploying new version to instance(s).
2020-06-21 04:13:51    ERROR   Your requirements.txt is invalid. Snapshot your logs for details.
2020-06-21 04:13:55    ERROR   [Instance: i-06c2884999a9d6064] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
File "/usr/lib64/python2.7/subprocess.py", line 190, 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.
2020-06-21 04:13:55    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].

我的requirements.txt文件:

APScheduler==3.6.3
asgiref==3.2.10
braintree==4.1.0
CacheControl==0.12.6
cachetools==4.1.0
certifi==2020.4.5.2
chardet==3.0.4
defusedxml==0.6.0
Django==3.0.7
django-allauth==0.42.0
django-cors-headers==3.4.0
django-mysql==3.7.0
django-rest-auth==0.9.5
djangorestframework==3.11.0
firebase-admin==4.3.0
google-api-core==1.21.0
google-api-python-client==1.9.3
google-auth==1.18.0
google-auth-httplib2==0.0.3
google-cloud-core==1.3.0
google-cloud-firestore==1.7.0
google-cloud-storage==1.29.0
google-resumable-media==0.5.1
googleapis-common-protos==1.52.0
grpcio==1.29.0
httplib2==0.18.1
idna==2.9
msgpack==1.0.0
mysqlclient==1.4.6
numpy==1.18.5
oauthlib==3.1.0
protobuf==3.12.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
PyJWT==1.7.1
python3-openid==3.1.0
pytz==2020.1
requests==2.24.0
requests-oauthlib==1.3.0
rsa==4.6
six==1.15.0
sqlparse==0.3.1
twilio==6.42.0
tzlocal==2.1
uritemplate==3.0.1
urllib3==1.25.9

一些日志文件:

     gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DOPENSSL_NO_ASM=1 -D_WIN32_WINNT=1536 -DGPR_BACKWARDS_COMPATIBILITY_MODE=1 -DHAVE_CONFIG_H=1 -DGRPC_ENABLE_FORK_SUPPORT=1 -DPyMODINIT_FUNC=extern "C" __attribute__((visibility ("default"))) PyObject* -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1 -Isrc/python/grpcio -Iinclude -I. -Ithird_party/abseil-cpp -Ithird_party/address_sorting/include -Ithird_party/cares -Ithird_party/cares/cares -Ithird_party/cares/config_linux -Ithird_party/boringssl-with-bazel/src/include -Ithird_party/upb -Isrc/core/ext/upb-generated -Ithird_party/zlib -I/usr/include/python3.6m -c src/python/grpcio/grpc/_cython/cygrpc.cpp -o python_build/temp.linux-x86_64-3.6/src/python/grpcio/grpc/_cython/cygrpc.o -std=c++11 -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions -pthread
  gcc: error trying to exec 'cc1plus': execvp: No such file or directory
  creating tmp/tmpi4o4pn51
  gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.6m -c /tmp/tmpi4o4pn51/a.c -o tmp/tmpi4o4pn51/a.o
  Traceback (most recent call last):
    File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 127, in _compile
      extra_postargs)
    File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
      _classic_spawn(self, command)
    File "/usr/lib64/python3.6/distutils/ccompiler.py", line 909, in spawn
      spawn(cmd, dry_run=self.dry_run)
    File "/usr/lib64/python3.6/distutils/spawn.py", line 36, in spawn
      _spawn_posix(cmd, search_path, dry_run=dry_run)
    File "/usr/lib64/python3.6/distutils/spawn.py", line 159, in _spawn_posix
      % (cmd, exit_status))
  distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 262, in build_extensions
      build_ext.build_ext.build_extensions(self)
    File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
      self._build_extensions_serial()
    File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
      self.build_extension(ext)
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
      _build_ext.build_extension(self, ext)
    File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 533, in build_extension
      depends=ext.depends)
    File "/usr/lib64/python3.6/distutils/ccompiler.py", line 574, in compile
      self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
    File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 246, in new_compile
      pp_opts)
    File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 129, in _compile
      raise CompileError(msg)
  distutils.errors.CompileError: command 'gcc' failed with exit status 1
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-29tk6f4m/grpcio/setup.py", line 400, in <module>
      cmdclass=COMMAND_CLASS,
    File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
      return orig.install.run(self)
    File "/usr/lib64/python3.6/distutils/command/install.py", line 593, in run
      self.run_command('build')
    File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 75, in run
      _build_ext.run(self)
    File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 267, in build_extensions
      "Failed `build_ext` step:\n{}".format(formatted_exception))
  commands.CommandError: Failed `build_ext` step:
  Traceback (most recent call last):
    File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 127, in _compile
      extra_postargs)
    File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
      _classic_spawn(self, command)
    File "/usr/lib64/python3.6/distutils/ccompiler.py", line 909, in spawn
      spawn(cmd, dry_run=self.dry_run)
    File "/usr/lib64/python3.6/distutils/spawn.py", line 36, in spawn
      _spawn_posix(cmd, search_path, dry_run=dry_run)
    File "/usr/lib64/python3.6/distutils/spawn.py", line 159, in _spawn_posix
      % (cmd, exit_status))
  distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 262, in build_extensions
      build_ext.build_ext.build_extensions(self)
    File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
      self._build_extensions_serial()
    File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
      self.build_extension(ext)
    File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
      _build_ext.build_extension(self, ext)
    File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 533, in build_extension
      depends=ext.depends)
    File "/usr/lib64/python3.6/distutils/ccompiler.py", line 574, in compile
      self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
    File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 246, in new_compile
      pp_opts)
    File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 129, in _compile
      raise CompileError(msg)
  distutils.errors.CompileError: command 'gcc' failed with exit status 1
    Command "/opt/python/run/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-29tk6f4m/grpcio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ox9mho6_-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/grpcio" failed with error code 1 in /tmp/pip-build-29tk6f4m/grpcio/
You are using pip version 9.0.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2020-06-19 20:06:16,263 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 190, 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)

[2020-06-19T20:06:16.273Z] INFO  [6647]  - [Application update app-200619_130554@310/AppDeployStage0/AppDeployPreHook/03deploy.py] : Activity failed.
[2020-06-19T20:06:16.273Z] INFO  [6647]  - [Application update app-200619_130554@310/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2020-06-19T20:06:16.273Z] INFO  [6647]  - [Application update app-200619_130554@310/AppDeployStage0] : Activity failed.
[2020-06-19T20:06:16.275Z] INFO  [6647]  - [Application update app-200619_130554@310] : Completed activity. Result:
Application update - Command CMD-AppDeploy failed
[2020-06-19T20:07:34.137Z] INFO  [6815]  - [CMD-BundleLogs] : Starting activity...
[2020-06-19T20:07:34.138Z] INFO  [6815]  - [CMD-BundleLogs/AddonsBefore] : Starting activity...
[2020-06-19T20:07:34.138Z] INFO  [6815]  - [CMD-BundleLogs/AddonsBefore] : Completed activity.
[2020-06-19T20:07:34.138Z] INFO  [6815]  - [CMD-BundleLogs/BundleLogs] : Starting activity...
[2020-06-19T20:07:34.138Z] INFO  [6815]  - [CMD-BundleLogs/BundleLogs/BundleLogs] : Starting activity...

最佳答案

pip install grpcio==1.26.0rc1

解决办法是降级grpcio。不幸的是,自从 Django 2.1 is the latest compatible version使用 Elastic Beanstalk Python 3.6 平台,我们有时必须相应地降级其他软件包。

希望 AWS 最终能够升级该平台,以便与最新的 Django 一起使用...

关于python - AWS Elastic Beanstalk 无法使用requirements.txt 安装Python 包 - Firebase-Admin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62501722/

相关文章:

firebase - 如何将 Flutter(Web 应用程序)流构建器与 Firestore 结合使用

python - 我将如何使用南迁移将数据加载到 Django 的 auth_group 表中?

python - 绘制直方图以找出图像上梯度的最大强度

python - Django 无法删除/清除表单上的数据

python - 当某些行返回该相关对象的空值时,如何使用 select_lated() ?

javascript - DocumentReference 返回敏感数据 - Firestore

Firebase RTD,原子 "move"... 从两个 "tables"删除和添加?

python - 使用 Python 将本地驱动器(而非 URL)中的照片上传到 Facebook 粉丝页面

python - 将 openssl 命令的输出转换为 JSON

python - Django assertTemplateUsed() 使用 Jinja 模板抛出异常