Not able to setup airflow, getting error while “Initiating Airflow Database”

巧了我就是萌 提交于 2021-02-10 06:52:08

问题


Not able to setup airflow, getting error while "Initiating Airflow Database" . I am getting the below error:

  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)

Is it something to do with the path?


回答1:


This is a bug in cattrs with Python 3.8, open issue: https://github.com/Tinche/cattrs/issues/46

I would suggest using Python 3.7




回答2:


I have re-created the issue using python 3.8 and looks like there is already patch code ready to released in newer version of airflow.

Meanwhile i would recommend downgrading your python version to 3.7.x and re-running the airflow initdb command.

(I have successfully installed airflow in my sandbox using python 3.7.7)



来源:https://stackoverflow.com/questions/60384306/not-able-to-setup-airflow-getting-error-while-initiating-airflow-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!