Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Airflow - ImportError: No module named clsregistry

Hi I am new to airflow and try to install it. And I can install airflow successfully but when I do an airflow initdb, the error is :

(airflow_virtualenv) C02CF6JRMD6R:bin ybao$ airflow initdb

    Traceback (most recent call last):   File "/Users/ybao/airflow_virtualenv/bin/airflow", line 26, in <module>
        from airflow.bin.cli import CLIFactory   File "/Users/ybao/airflow_virtualenv/lib/python2.7/site-packages/airflow/bin/cli.py", line 82, in <module>
        from airflow.www.app import (cached_app, create_app)   File "/Users/ybao/airflow_virtualenv/lib/python2.7/site-packages/airflow/www/app.py", line 42, in <module>
        from airflow.www.blueprints import routes   File "/Users/ybao/airflow_virtualenv/lib/python2.7/site-packages/airflow/www/blueprints.py", line 25, in <module>
        from airflow.www import utils as wwwutils   File "/Users/ybao/airflow_virtualenv/lib/python2.7/site-packages/airflow/www/utils.py", line 40, in <module>
        import flask_admin.contrib.sqla.filters as sqlafilters   File "/Users/ybao/airflow_virtualenv/lib/python2.7/site-packages/flask_admin/contrib/sqla/__init__.py", line 2, in <module>
        from .view import ModelView   File "/Users/ybao/airflow_virtualenv/lib/python2.7/site-packages/flask_admin/contrib/sqla/view.py", line 18, in <module>
        from flask_admin.contrib.sqla.tools import is_relationship   File "/Users/ybao/airflow_virtualenv/lib/python2.7/site-packages/flask_admin/contrib/sqla/tools.py", line 4, in <module>
        from sqlalchemy.ext.declarative.clsregistry import _class_resolver ImportError: No module named clsregistry

Where should I install the packages?

Thanks!!

like image 383
YihanBao Avatar asked Mar 24 '21 02:03

YihanBao


1 Answers

What version of airflow are you using?

I just ran into this issue using apache-airflow 1.10.14.

This issue was linked to the recent release of SQLAlchemy (1.4.2) or Flask-SQLAlchemy (2.5.1)

Reverting those dependencies to the previous version fixed it for me:

pip install SQLAlchemy==1.3.23 
pip install Flask-SQLAlchemy==2.4.4
like image 140
micah_prime Avatar answered Nov 13 '22 05:11

micah_prime