pip在新的虚拟环境上安装apache-airflow然后是airit initdb:SyntaxError

时间:2019-01-27 07:04:44

标签: pip airflow

$ virtualenv --version
16.3.0
$ pip --version
pip 19.0.1

我创造了一个新鲜的环境。并运行

pip install apache-airflow

已成功安装

apache-airflow   1.10.2 

但是我运行

 airflow initdb

我得到了错误

ERROR [airflow.models.DagBag] Failed to import: /Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/example_dags/example_http_operator.py
    Traceback (most recent call last):
      File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/models.py", line 374, in process_file
        m = imp.load_source(mod_name, filepath)
      File "/Users/admin/workshops/apache/airflow/lib/python3.7/imp.py", line 171, in load_source
        module = _load(spec)
      File "<frozen importlib._bootstrap>", line 696, in _load
      File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 728, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/example_dags/example_http_operator.py", line 27, in <module>
        from airflow.operators.http_operator import SimpleHttpOperator
      File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/operators/http_operator.py", line 21, in <module>
        from airflow.hooks.http_hook import HttpHook
      File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/airflow/hooks/http_hook.py", line 23, in <module>
        import tenacity
      File "/Users/admin/workshops/apache/airflow/lib/python3.7/site-packages/tenacity/__init__.py", line 352
        from tenacity.async import AsyncRetrying
                          ^
    SyntaxError: invalid syntax

这是一个全新的虚拟环境。我没有安装其他任何东西。

1 个答案:

答案 0 :(得分:4)

可以发现hereasync自Python 3.7起就成为关键字。您可以使用Python <3.7创建虚拟环境并安装Airflow。也许您还可以尝试将tenacity升级到> = 4.10.0,因为该版本中解决了韧性问题。