无法设置气流,在“启动气流数据库”时出错

时间:2020-02-24 21:40:44

标签: python installation airflow

无法设置气流,在“启动气流数据库”时出错。我收到以下错误:

  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/airflow", line 26, in <module>
    from airflow.bin.cli import CLIFactory
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/airflow/bin/cli.py", line 79, in <module>
    api_module = import_module(conf.get('cli', 'api_client'))  # type: Any
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/airflow/api/client/local_client.py", line 24, in <module>
    from airflow.api.common.experimental import delete_dag
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/airflow/api/common/experimental/delete_dag.py", line 25, in <module>
    from airflow.models.serialized_dag import SerializedDagModel
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/airflow/models/serialized_dag.py", line 32, in <module>
    from airflow.serialization.serialized_objects import SerializedDAG
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/airflow/serialization/serialized_objects.py", line 28, in <module>
    import cattr
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cattr/__init__.py", line 2, in <module>
    from .converters import Converter, UnstructureStrategy
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cattr/converters.py", line 3, in <module>
    from ._compat import (
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cattr/_compat.py", line 86, in <module>
    from typing import _Union
ImportError: cannot import name '_Union' from 'typing' (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/typing.py)

与路径有关吗?

2 个答案:

答案 0 :(得分:1)

这是cattrs在Python 3.8中的错误,未解决的问题:https://github.com/Tinche/cattrs/issues/46

我建议使用Python 3.7

答案 1 :(得分:0)

我已经使用python 3.8重新创建了该问题,并且看起来已经有补丁代码可以在较新版本的airflow中发布。

同时,我建议将python版本降级到3.7.x,然后重新运行airflow initdb命令。

(我已使用python 3.7.7在沙箱中成功安装了气流)