I am trying to install Airflow in EC2 (Amazon Linux) and "airflow initdb" fails with the following error:
$ 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
Since this is a syntax error, I suspect there is some version conflict between marshmallow_sqlalchemy and SQLAlchemy. Here are their versions:
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
Any idea?
Installing via Poetry or pip-tools is not currently supported. If you wish to install airflow using those tools you should use the constraints and convert them to appropriate format and workflow that your tool requires.
looks like the marshmallow-sqlalchemy version has upgraded, that is why you are getting this error. Uninstall the current version-
pip uninstall marshmallow-sqlalchemy
and try installing the below version, and then you should be good to go.
pip install marshmallow-sqlalchemy==0.17.1
I was also facing the similar issue but now it is resolved in the same way. Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With