问题
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):
^
my install steps are as follows:
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 &
I have also tried installing Postgres, as per some of the instruction online:
sudo apt-get install postgresql postgresql-contrib -y
or: pip install apache-airflow[postgres]
Not much is said about any configuration file changes that may be necessary.
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?
回答1:
That is because marshmallow-sqlalchemy
version has upgraded and it broke compatibility with py2 and py3.5 with 0.19.0
Run the following
pip install marshmallow-sqlalchemy==0.17.1
and it should work.
Related issue on Airflow Jira: https://issues.apache.org/jira/browse/AIRFLOW-5430
来源:https://stackoverflow.com/questions/58103825/why-does-apache-airflow-fail-with-the-command-airflow-initdb