0

I tried to install airflow on 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. 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.

searain
  • 3,143
  • 6
  • 28
  • 60
  • Could it be because you are using anaconda and the package `dill` differs from the Python version? – tobi6 Jan 04 '19 at 09:31

1 Answers1

1

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.

I created a test conda environment on my mac, and tried the failing import with various versions of dill via a pip install.

Results with dill version 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):

(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/

scotthb
  • 76
  • 3
  • Thanks. it is the version of dill issue. On another Mac, I have newer anaconda, and I don't have this error. airflow initdb works fine. I will try to update anaconda and to see if it will fix the problem – searain Jan 09 '19 at 06:41
  • But when I try fresh install on a fresh environment (python 3), I still got error when I airflow initdb. I will ask it in another thread. – searain Jan 27 '19 at 06:52