本文介绍了气流initdb:ImportError:无法导入名称“ HTMLString”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到 ImportError:在运行 airflow initdb

File "/home/ubuntu/airflow_env/bin/airflow", line 26, in <module>
    from airflow.bin.cli import CLIFactory
  File "/home/ubuntu/airflow_env/lib/python3.6/site-packages/airflow/bin/cli.py", line 71, in <module>
    from airflow.www_rbac.app import cached_app as cached_app_rbac
  File "/home/ubuntu/airflow_env/lib/python3.6/site-packages/airflow/www_rbac/app.py", line 27, in <module>
    from flask_appbuilder import AppBuilder, SQLA
  File "/home/ubuntu/airflow_env/lib/python3.6/site-packages/flask_appbuilder/__init__.py", line 6, in <module>
    from .base import AppBuilder  # noqa: F401
  File "/home/ubuntu/airflow_env/lib/python3.6/site-packages/flask_appbuilder/base.py", line 8, in <module>
    from .api.manager import OpenApiManager
  File "/home/ubuntu/airflow_env/lib/python3.6/site-packages/flask_appbuilder/api/manager.py", line 7, in <module>
    from flask_appbuilder.baseviews import BaseView
  File "/home/ubuntu/airflow_env/lib/python3.6/site-packages/flask_appbuilder/baseviews.py", line 21, in <module>
    from .forms import GeneralModelConverter
  File "/home/ubuntu/airflow_env/lib/python3.6/site-packages/flask_appbuilder/forms.py", line 17, in <module>
    from .fieldwidgets import (
  File "/home/ubuntu/airflow_env/lib/python3.6/site-packages/flask_appbuilder/fieldwidgets.py", line 3, in <module>
    from wtforms.widgets import html_params, HTMLString
ImportError: cannot import name 'HTMLString'




  • apache-airflow == 1.10.9,SQLAlchemy == 1.3.15

  • 推荐答案

    最新版本的WTForms打破了气流。您有2个选择:

    The recent release of WTForms broke Airflow. You have 2 options:

    1)安装有约束条件的

    1) Install it with constraints

    对于 Python 3.7

    pip install apache-airflow==1.10.9 \
       --constraint https://raw.githubusercontent.com/apache/airflow/1.10.10/requirements/requirements-python3.7.txt
    

    对于 Python 3.6

    pip install apache-airflow==1.10.9 \
       --constraint https://raw.githubusercontent.com/apache/airflow/1.10.10/requirements/requirements-python3.6.txt
    

    2)Pin WTForms

    2) Pin WTForms

    pip install wtforms==2.3.1 
    

    这篇关于气流initdb:ImportError:无法导入名称“ HTMLString”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 22:03