简体   繁体   English

在iMac上安装Apache-Airflow-Airflow InitDB-ImportError:无法导入名称对象

[英]Install Apache-Airflow on iMac - airflow initdb - ImportError: cannot import name objects

I tried to install airflow on iMac 我试图在iMac上安装气流

airflow initdb

I got this error 我得到这个错误

Traceback (most recent call last):
    File "/Users/admin/anaconda/bin/airflow", line 21, in <module>
      from airflow import configuration
    File "/Users/admin/anaconda/lib/python2.7/site-packages/airflow/__init__.py", line 37, in <module>
      from airflow.models import DAG
    File "/Users/admin/anaconda/lib/python2.7/site-packages/airflow/models.py", line 32, in <module>
      import dill
    File "/Users/admin/anaconda/lib/python2.7/site-packages/dill/__init__.py", line 60, in <module>
      from . import objtypes as types
    File "/Users/admin/anaconda/lib/python2.7/site-packages/dill/objtypes.py", line 16, in <module>
      from dill import objects
    ImportError: cannot import name objects

I found this thread, While airflow initdb, ImportError: cannot import name HiveOperator , it is not for install airflow on iMac, and the error is not exactly the same. 我发现了这个线程, 当airit initdb时,ImportError:无法导入名称HiveOperator ,这不是为了在iMac上安装airflow ,并且错误并不完全相同。 But I gave a try anyway. 但是我还是尝试了。 I changed the config 我改变了配置

# load_examples = True # default set up as True
load_examples = False # change to false to avoid airflow initdb error - But the error still there. 

But I still get the same error when I run airflow initdb. 但是,当我运行气流initdb时,我仍然遇到相同的错误。

You might want to check the version of dill installed on your system. 您可能要检查系统上安装的莳萝的版本。 Versions prior to 0.2a1 (specifically version 0.1a1) do not contain 'objects', and would throw the error you see above. 0.2a1之前的版本(特别是0.1a1版)不包含“对象”,并且会引发您在上面看到的错误。

I created a test conda environment on my mac, and tried the failing import with various versions of dill via a pip install. 我在Mac上创建了一个测试conda环境,并尝试通过pip安装使用各种莳萝版本导入失败。

Results with dill version 0.1a1: 莳萝版本0.1a1的结果:

(dill_test) pip install dill==0.1a1
Collecting dill==0.1a1
Installing collected packages: dill
Successfully installed dill-0.1a1
(dill_test)  python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
>>> from dill import objects
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name objects

Results with dill version 0.2a1 or above (no error on import of objects): 莳萝版本为0.2a1或更高版本的结果(导入对象时没有错误):

(dill_test) pip uninstall dill
Uninstalling dill-0.1a1:
  Would remove:
    /Users/.../anaconda2/envs/dill_test/lib/python2.7/site-packages/dill-    0.1a1.dist-info/*
    /Users/.../anaconda2/envs/dill_test/lib/python2.7/site-packages/dill/*
Proceed (y/n)? y
  Successfully uninstalled dill-0.1a1
(dill_test) pip install dill==0.2a1
Collecting dill==0.2a1
Installing collected packages: dill
Successfully installed dill-0.2a1
(dill_test) python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
>>> from dill import objects
>>>

https://pypi.org/project/dill/ https://pypi.org/project/dill/

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

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