Skip to content

ImportError in Quick Start example #12581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
igordertigor opened this issue Nov 24, 2020 · 5 comments
Closed

ImportError in Quick Start example #12581

igordertigor opened this issue Nov 24, 2020 · 5 comments
Labels
area:dependencies Issues related to dependencies problems kind:bug This is a clearly a bug

Comments

@igordertigor
Copy link

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
@igordertigor igordertigor added the kind:bug This is a clearly a bug label Nov 24, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 24, 2020

Thanks for opening your first issue here! Be sure to follow the issue template!

@igordertigor
Copy link
Author

This seems to be a dependency issue: At the end of the pip install apache-airflow I noticed the following error:

ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.                                        
                                                                                                        
We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.                                                                                     
                                                                                                        
cattrs 1.1.1 requires attrs>=20.1.0, but you'll have attrs 19.3.0 which is incompatible.                
marshmallow-sqlalchemy 0.24.1 requires marshmallow>=3.0.0, but you'll have marshmallow 2.21.0 which is incompatible.                                                                                            

Manually forcing the installation by pip install attrs==20.1.0 cattrs=1.1.1 fixes the initdb command, but gives a similar error (again, the red text starts with the pip message about October 2020):

apache-airflow 1.10.12 requires attrs~=19.3, but you'll have attrs 20.1.0 which is incompatible.

However, not the commands from the quickstart work.

I tried to fix this, but the listed dependencies in setup.cfg list attrs>=20.0, <21.0, which seems correct to me.

@turbaszek
Copy link
Member

Related to #10854 #12508

@turbaszek turbaszek reopened this Nov 24, 2020
@turbaszek turbaszek added the area:dependencies Issues related to dependencies problems label Nov 24, 2020
@ashb
Copy link
Member

ashb commented Nov 24, 2020

This one was fine when 1.10.12 was released -- fixed by #11969 for 1.10.13 (which was added via this cherry pick 6b41e95)

@ashb ashb closed this as completed Nov 24, 2020
@igordertigor
Copy link
Author

Great! Thanks for the pointer. When I opened the issue, I obviously didn't think of the right keywords that would have led me to the issue/pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dependencies Issues related to dependencies problems kind:bug This is a clearly a bug
Projects
None yet
Development

No branches or pull requests

3 participants