本文介绍了为什么Apache airflow使用以下命令失败:“ airflow initdb”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在AWS EC2实例上安装气流。网络上的各种来源似乎都很好地记录了该过程,但是,在 pip安装气流之后,我遇到了一个问题;执行命令'airflow initdb'时出现以下错误:

I am trying to install airflow on an AWS EC2 instance. The process seems to be pretty well documented by various sources on the web, however, I have run into a problem after I 'pip install' airflow; I get the below error when I execute the command 'airflow initdb':

[2019-09-25 13:22:02,329] {__init__.py:51} INFO - Using executor SequentialExecutor
Traceback (most recent call last):
  File "/home/cloud-user/.local/bin/airflow", line 22, in <module>
    from airflow.bin.cli import CLIFactory
  File "/home/cloud-user/.local/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 "/home/cloud-user/.local/lib/python2.7/site-packages/airflow/www_rbac/app.py", line 26, in <module>
    from flask_appbuilder import AppBuilder, SQLA
  File "/home/cloud-user/.local/lib/python2.7/site-packages/flask_appbuilder/__init__.py", line 5, in <module>
    from .base import AppBuilder
  File "/home/cloud-user/.local/lib/python2.7/site-packages/flask_appbuilder/base.py", line 5, in <module>
    from .api.manager import OpenApiManager
  File "/home/cloud-user/.local/lib/python2.7/site-packages/flask_appbuilder/api/__init__.py", line 11, in <module>
    from marshmallow_sqlalchemy.fields import Related, RelatedList
  File "/home/cloud-user/.local/lib/python2.7/site-packages/marshmallow_sqlalchemy/__init__.py", line 1, in <module>
    from .schema import TableSchemaOpts, ModelSchemaOpts, TableSchema, ModelSchema
  File "/home/cloud-user/.local/lib/python2.7/site-packages/marshmallow_sqlalchemy/schema.py", line 101
    class TableSchema(ma.Schema, metaclass=TableSchemaMeta):

                                      ^

我的安装步骤如下:

sudo apt update -y
sudo apt install python-pip -y
pip install apache-airflow
export AIRFLOW_HOME=~/.local/bin
export PATH=$PATH:$AIRFLOW_HOME
cd $AIRFLOW_HOME
mkdir dags/
airflow initdb
airflow scheduler &
airflow webserver &

我也尝试过安装Postgres,根据在线说明:

I have also tried installing Postgres, as per some of the instruction online:

sudo apt-get install postgresql postgresql-contrib -y

或: pip install apache-airflow [postgres]

关于可能需要进行的任何配置文件更改。

Not much is said about any configuration file changes that may be necessary.

虽然我坚持initdb步骤,但最终目标是将数据库分离到自己的RDS实例中。

While I am stuck on the initdb step, the ultimate goal is to have the database separated out into its own RDS instance.

我还阅读了一些文档,指出可以在虚拟环境中运行气流,但这是一项要求吗?

I have also read some documentation that states that running airflow in a virtual environment is possible, but is this a requirement?

推荐答案

这是因为 marshmallow-sqlalchemy 版本已升级,并且破坏了与py2和py3.5与0.19.0的兼容性

That is because marshmallow-sqlalchemy version has upgraded and it broke compatibility with py2 and py3.5 with 0.19.0

运行以下命令

pip install marshmallow-sqlalchemy==0.17.1

,它应该可以工作。

有关Airflow Jira的相关问题:

Related issue on Airflow Jira: https://issues.apache.org/jira/browse/AIRFLOW-5430

这篇关于为什么Apache airflow使用以下命令失败:“ airflow initdb”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 18:24