简体   繁体   English

airflow initdb:ImportError:无法导入名称“HTMLString”

[英]airflow initdb: ImportError: cannot import name 'HTMLString'

I'm getting ImportError: cannot import name 'HTMLString' on running airflow initdb我收到ImportError: cannot import name 'HTMLString' on running 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阿帕奇气流 == 1.10.9,SQLAlchemy == 1.3.15

The recent release of WTForms broke Airflow. 最近发布的 WTForms 打破了 Airflow。 You have 2 options:您有 2 个选项:

1) Install it with constraints 1)安装有约束

For Python 3.7对于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

For Python 3.6对于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) 固定 WTForms

pip install wtforms==2.3.1 

It's related to latest wtforms release, you can see the details in https://github.com/apache/airflow/issues/8506 .它与最新的 wtforms 版本有关,您可以在https://github.com/apache/airflow/issues/8506中查看详细信息。

Run the跑过

pip install wtforms<2.3.0 

before installing airflow, so this dependency is met by airflow and the upgraded package is not installed.在安装 airflow 之前,因此 airflow 满足此依赖关系,并且未安装升级后的 package。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM