Skip to content

ImportError in Quick Start example #12581

@igordertigor

Description

@igordertigor

The airflow quickstart example doesn't run for me on ubuntu 20.04. I'm using python3.8 in a fresh virtual environment like this

python -m venv airflow_env
source airflow_env/bin/activate
pip install -U pip
pip install apache-airflow
airflow initdb

This raises an ImportError (see below for full stacktrace) when attempting to import resolve_types from attr. The ~/airflow folder gets created and (at least partially populated). Attempting airflow webserver -p 8080 fails too, with the same error message.

Traceback (most recent call last):
  File "/home/xxx/tmp/tryairflow/airflow_env/bin/airflow", line 26, in <module>
    from airflow.bin.cli import CLIFactory
  File "/home/xxx/tmp/tryairflow/airflow_env/lib/python3.8/site-packages/airflow/bin/cli.py", line 94, in <module>
    api_module = import_module(conf.get('cli', 'api_client'))  # type: Any
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/xxx/tmp/tryairflow/airflow_env/lib/python3.8/site-packages/airflow/api/client/local_client.py", line 24, in <module>
    from airflow.api.common.experimental import delete_dag
  File "/home/xxx/tmp/tryairflow/airflow_env/lib/python3.8/site-packages/airflow/api/common/experimental/delete_dag.py", line 26, in <module>
    from airflow.models.serialized_dag import SerializedDagModel
  File "/home/xxx/tmp/tryairflow/airflow_env/lib/python3.8/site-packages/airflow/models/serialized_dag.py", line 35, in <module>
    from airflow.serialization.serialized_objects import SerializedDAG
  File "/home/xxx/tmp/tryairflow/airflow_env/lib/python3.8/site-packages/airflow/serialization/serialized_objects.py", line 28, in <module>
    import cattr
  File "/home/xxx/tmp/tryairflow/airflow_env/lib/python3.8/site-packages/cattr/__init__.py", line 1, in <module>
    from .converters import Converter, GenConverter, UnstructureStrategy
  File "/home/xxx/tmp/tryairflow/airflow_env/lib/python3.8/site-packages/cattr/converters.py", line 16, in <module>
    from attr import fields, resolve_types
ImportError: cannot import name 'resolve_types' from 'attr' (/home/xxx/tmp/tryairflow/airflow_env/lib/python3.8/site-packages/attr/__init__.py)

Apache Airflow version: 1.10.12 (current pypi default)

Kubernetes version (if you are using kubernetes) (use kubectl version): No kubernetes

Environment:

  • Cloud provider or hardware configuration: Stock laptop.
  • OS (e.g. from /etc/os-release): Ubuntu 20.04 LTS (Focal Fossa)
  • Kernel (e.g. uname -a): Linux 5.4.0.52-generic (Default Kernel)
  • Install tools: pip in virtual env (see above example to reproduce)
  • Others:

What happened: See above.

What you expected to happen:

  1. For the initdb command I expected either no message or a log-message stating that an sqlite database was initialized (or similar).
  2. I expected a webserver to start serving an app at port 8080.

How to reproduce it:
The code example at the top reproduces the error reliably on this computer, even if I use slight variations of the virtualenv creation (e.g. skip pip install -U pip or use a different name for the virtualenv).

Anything else we need to know:
For completeness also, the full content of the ~/airflow/ folder:

tree ~/airflow
/home/xxx/airflow
├── airflow.cfg
├── logs
│   └── scheduler
│       ├── 2020-11-24
│       └── latest -> /home/xxx/airflow/logs/scheduler/2020-11-24
└── unittests.cfg

4 directories, 2 files

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:dependenciesIssues related to dependencies problemskind:bugThis is a clearly a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions