Amazon 中的 Airflow initdb 失败 Linux

Airflow initdb failed in Amazon Linux

我正在尝试在 EC2 (Amazon Linux) 中安装 Airflow,但 "airflow initdb" 失败并出现以下错误:

$ AIRFLOW_HOME=/var/lib/airflow airflow initdb
[2019-09-07 20:51:32,416] {__init__.py:51} INFO - Using executor SequentialExecutor
Traceback (most recent call last):
  File "/bin/airflow", line 22, in <module>
    from airflow.bin.cli import CLIFactory
  File "/usr/lib/python2.7/site-packages/airflow/bin/cli.py", line 68, in <module>
    from airflow.www_rbac.app import cached_app as cached_app_rbac
  File "/usr/lib/python2.7/site-packages/airflow/www_rbac/app.py", line 26, in <module>
    from flask_appbuilder import AppBuilder, SQLA
  File "/usr/lib/python2.7/site-packages/flask_appbuilder/__init__.py", line 5, in <module>
    from .base import AppBuilder
  File "/usr/lib/python2.7/site-packages/flask_appbuilder/base.py", line 5, in <module>
    from .api.manager import OpenApiManager
  File "/usr/lib/python2.7/site-packages/flask_appbuilder/api/__init__.py", line 11, in <module>
    from marshmallow_sqlalchemy.fields import Related, RelatedList
  File "/usr/lib/python2.7/site-packages/marshmallow_sqlalchemy/__init__.py", line 1, in <module>
    from .schema import TableSchemaOpts, ModelSchemaOpts, TableSchema, ModelSchema
  File "/usr/lib/python2.7/site-packages/marshmallow_sqlalchemy/schema.py", line 101
    class TableSchema(ma.Schema, metaclass=TableSchemaMeta):
                                      ^
SyntaxError: invalid syntax

由于这是一个语法错误,我怀疑 marshmallow_sqlalchemy 和 SQLAlchemy 之间存在一些版本冲突。以下是他们的版本:

apache-airflow==1.10.5
Flask==1.1.1
Flask-SQLAlchemy==2.4.0
marshmallow==2.20.3
marshmallow-enum==1.5.1
marshmallow-sqlalchemy==0.19.0
SQLAlchemy==1.3.8

有什么想法吗?

看来 marshmallow-sqlalchemy 版本已升级,这就是您收到此错误的原因。卸载当前版本-

pip 卸载 marshmallow-sqlalchemy

并尝试安装以下版本,然后你就可以开始了。

pip install marshmallow-sqlalchemy==0.17.1

我也遇到过类似的问题,现在已经用同样的方法解决了。 希望对您有所帮助!