hankehly opened a new issue #13149:
URL: https://github.com/apache/airflow/issues/13149


   **Apache Airflow version**: 2.0
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: Local development 
environment using docker
   - **OS** (e.g. from /etc/os-release): macOS Catalina (10.15.7)
   - **Kernel** (e.g. `uname -a`): Darwin
   - **Install tools**: [poetry](https://python-poetry.org/)
   - **Others**: docker 20.10.0, postgres, Python 3.7.9
   
   **What happened**:
   
   A fresh installation of airflow 2.0 seems to be failing on `airflow db init` 
with what looks like a 3rd-party library exception (see traceback below). I 
searched for related issues on github/google; but didn't find anything useful.
   
   **What you expected to happen**:
   
   Given I couldn't find any useful information online, this makes me think the 
problem is my environment. I will continue to look at it, but in the meantime 
I'd like to put this out there in case anyone else has had a similar issue.
   
   **How to reproduce it**:
   
   #### 1. Install [poetry](https://github.com/python-poetry/poetry) package 
manager
   ```
   curl -sSL 
https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | 
python
   ```
   
   #### 2. Create a `docker-compose.yml` file inside a new directory
   ```yaml
   version: "3.9"
   services:
     db:
       environment:
         POSTGRES_USER: airflow
         POSTGRES_PASSWORD: airflow
         POSTGRES_DB: airflow
         POSTGRES_PORT: 5432
       image: postgres
       ports:
         - 5432:5432
   ```
   
   #### 3. Create a `pyproject.toml` file inside the same directory as (2)
   ```toml
   [tool.poetry]
   name = "airflow-2-docker-example"
   version = "0.1.0"
   description = ""
   authors = ["name <n...@example.com>"]
   
   [tool.poetry.dependencies]
   python = "^3.7"
   apache-airflow = "^2.0.0"
   psycopg2-binary = "^2.8.6"
   
   [tool.poetry.dev-dependencies]
   
   [build-system]
   requires = ["poetry-core>=1.0.0"]
   build-backend = "poetry.core.masonry.api"
   ```
   
   #### 4. Install python packages and bring up the database
   ```sh
   poetry install
   docker-compose up -d
   ```
   
   #### 5. Initialize airflow database
   ```sh
   
AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@localhost:5432/airflow
 poetry run airflow db init
   ```
   
   **Anything else we need to know**:
   
   <!--
   
   How often does this problem occur? Once? Every time etc?
   
   Any relevant logs to include? Put them here in side a detail tag:
   <details><summary>x.log</summary> lots of stuff </details>
   
   -->
   
   <details>
   <summary><b>Traceback</b></summary>
   
   ```
   hankehly ~/src/airflow-2-docker-example $ 
AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@localhost:5432/airflow
 poetry run airflow db init
   DB: postgresql+psycopg2://airflow:***@localhost:5432/airflow
   [2020-12-18 19:23:20,344] {db.py:678} INFO - Creating tables
   INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
   INFO  [alembic.runtime.migration] Will assume transactional DDL.
   INFO  [alembic.runtime.migration] Running upgrade 849da589634d -> 
2c6edca13270, Resource based permissions.
   Traceback (most recent call last):
     File "/Users/hankehly/src/airflow-2-docker-example/.venv/bin/airflow", 
line 8, in <module>
       sys.exit(main())
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/__main__.py",
 line 40, in main
       args.func(args)
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/cli/cli_parser.py",
 line 48, in command
       return func(*args, **kwargs)
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/cli/commands/db_command.py",
 line 31, in initdb
       db.initdb()
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/utils/db.py",
 line 549, in initdb
       upgradedb()
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/utils/db.py",
 line 688, in upgradedb
       command.upgrade(config, 'heads')
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/alembic/command.py",
 line 298, in upgrade
       script.run_env()
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/alembic/script/base.py",
 line 489, in run_env
       util.load_python_file(self.dir, "env.py")
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/alembic/util/pyfiles.py",
 line 98, in load_python_file
       module = load_module_py(module_id, path)
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/alembic/util/compat.py",
 line 184, in load_module_py
       spec.loader.exec_module(module)
     File "<frozen importlib._bootstrap_external>", line 728, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/migrations/env.py",
 line 108, in <module>
       run_migrations_online()
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/migrations/env.py",
 line 102, in run_migrations_online
       context.run_migrations()
     File "<string>", line 8, in run_migrations
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/alembic/runtime/environment.py",
 line 846, in run_migrations
       self.get_context().run_migrations(**kw)
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/alembic/runtime/migration.py",
 line 522, in run_migrations
       step.migration_fn(**kw)
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/migrations/versions/2c6edca13270_resource_based_permissions.py",
 line 310, in upgrade
       remap_permissions()
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/migrations/versions/2c6edca13270_resource_based_permissions.py",
 line 287, in remap_permissions
       appbuilder = create_app(config={'FAB_UPDATE_PERMS': False}).appbuilder
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/airflow/www/app.py",
 line 74, in create_app
       flask_app.config.from_pyfile(settings.WEBSERVER_CONFIG, silent=True)
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/flask/config.py",
 line 132, in from_pyfile
       exec(compile(config_file.read(), filename, "exec"), d.__dict__)
     File "/Users/hankehly/airflow/webserver_config.py", line 21, in <module>
       from flask_appbuilder.security.manager import AUTH_DB
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/flask_appbuilder/security/manager.py",
 line 13, in <module>
       from flask_openid import OpenID
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/flask_openid.py",
 line 26, in <module>
       from openid.store.filestore import FileOpenIDStore
     File 
"/Users/hankehly/src/airflow-2-docker-example/.venv/lib/python3.7/site-packages/openid/__init__.py",
 line 52, in <module>
       if len(version_info) != 3:
   TypeError: object of type 'map' has no len()
   ```
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to