Django приложение не может быть развернуто на AWS ElasticBeanstalk с библиотекой 'firebase-admin' - PullRequest
0 голосов
/ 19 апреля 2020

Я развертываю свое приложение python / django на aws эластичный стебель. Он будет развернут нормально, если я не укажу библиотеку 'firebase-admin' в файле require.txt. Но не удается развернуть, если я добавлю 'firebase-admin', независимо от того, какая версия в файле require.txt, как показано ниже: enter image description here

Вот мои требования.txt:

Django==3.0.1
djangorestframework==3.11.0
psycopg2==2.7.3.1
django-cors-headers==3.2.0
pytz==2017.2
tinys3==0.1.12
apiclient==1.0.3
drf_yasg==1.17.1
google-api-python-client==1.7.3
google-auth==1.5.0
google-auth-httplib2==0.0.3
httplib2==0.11.3
django-rest-auth==0.9.5
oauth2client==4.1.2
geographiclib==1.50
geopy==1.20.0
numpy==1.15.2
pyyaml==5.3.1

И AWSasticbeanstalk python Сведения об экземпляре: Python 3.6, работающие на 64-битной версии Amazon Linux / 2.9.7

Пожалуйста, помогите. Спасибо

ОБНОВЛЕНИЕ: С виртуальным окружением localhost отлично работают следующие файлы.

Django==3.0.1
djangorestframework==3.11.0
psycopg2==2.7.3.1
django-cors-headers==3.2.0
pytz==2017.2
tinys3==0.1.12
apiclient==1.0.3
drf_yasg==1.17.1
google-api-python-client==1.7.8
google-auth==1.14.0
google-auth-httplib2==0.0.3
httplib2==0.11.3
django-rest-auth==0.9.5
oauth2client==4.1.2
geopy==1.20.0
pyyaml==5.3.1
firebase-admin==2.13.0

Но при развертывании на AWS выдается следующая ошибка:

ERROR   Your requirements.txt is invalid. Snapshot your logs for details.
2020-04-22 00:14:47    ERROR   [Instance: i-0864d69c58c343870] 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. 

ЗАПОЛНЕНО AWS ЖУРНАЛ:

-------------------------------------
/var/log/eb-activity.log
-------------------------------------
          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-h4kd5_1k/grpcio/setup.py", line 400, in <module>
          cmdclass=COMMAND_CLASS,
        File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
          return distutils.core.setup(**attrs)
        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 87, 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-h4kd5_1k/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-h4kd5_1k/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-h4kd5_1k/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 208, 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-h4kd5_1k/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-h4kd5_1k/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-okr6a_v3-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-h4kd5_1k/grpcio/
  You are using pip version 9.0.1, however version 20.0.2 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
  2020-04-22 23:07:23,479 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/onde

ck/app/requirements.txt' returned non-zero exit status 1 (Executor::NonZeroExitStatus)

1 Ответ

1 голос
/ 21 апреля 2020

Я локально пробовал ваш файл needs.txt, что привело к следующим ошибкам:

ERROR: google-api-core 1.17.0 has requirement google-auth<2.0dev,>=1.14.0, but you'll have google-auth 1.5.0 which is incompatible.
ERROR: google-cloud-storage 1.27.0 has requirement google-auth<2.0dev,>=1.11.0, but you'll have google-auth 1.5.0 which is incompatible.
ERROR: firebase-admin 4.0.0 has requirement google-api-python-client>=1.7.8, but you'll have google-api-python-client 1.7.3 which is incompatible.

Скорее всего, это происходит и в вашей среде развертывания, за исключением того, что она не регистрирует ошибки. Попробуйте разрешить вышеуказанные конфликты зависимостей и повторите попытку.

...