You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "leweex95 (via GitHub)" <gi...@apache.org> on 2023/07/02 12:29:34 UTC

[GitHub] [airflow] leweex95 opened a new issue, #32316: Pydantic error when setting up airflow db using airflow db init

leweex95 opened a new issue, #32316:
URL: https://github.com/apache/airflow/issues/32316

   ### Apache Airflow version
   
   2.6.2
   
   ### What happened
   
   I installed `apache-airflow` and attempted to set up the db via: 
   
   `airflow db init`
   
   but it fails with the following pydantic error:
   
   ```
   DB: sqlite:////Users/username/airflow/airflow.db
   /Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py:257 UserWarning: Valid config keys have changed in V2:
   * 'orm_mode' has been renamed to 'from_attributes'
   Traceback (most recent call last):
     File "Users/username/Desktop/project_root/.venv/bin/airflow", line 8, in <module>
       sys.exit(main())
     File "Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/__main__.py", line 48, in main
       args.func(args)
     File "Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/cli/cli_config.py", line 52, in command
       return func(*args, **kwargs)
     File "Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/cli/commands/db_command.py", line 37, in initdb
       db.initdb()
     File "Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/utils/session.py", line 76, in wrapper
       return func(*args, session=session, **kwargs)
     File "Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/utils/db.py", line 711, in initdb
       import_all_models()
     File "Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/models/__init__.py", line 60, in import_all_models
       __getattr__(name)
     File "Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/models/__init__.py", line 78, in __getattr__
       val = import_string(f"{path}.{name}")
     File "/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/utils/module_loading.py", line 36, in import_string
       module = import_module(module_path)
     File "/opt/homebrew/Cellar/python@3.9/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
     File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
     File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 850, in exec_module
     File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
     File "/Users/levente_csibi/Desktop/Continental_HW/.venv/lib/python3.9/site-packages/airflow/models/skipmixin.py", line 25, in <module>
       from airflow.serialization.pydantic.dag_run import DagRunPydantic
     File "/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/serialization/pydantic/dag_run.py", line 24, in <module>
       from airflow.serialization.pydantic.dataset import DatasetEventPydantic
     File "/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/serialization/pydantic/dataset.py", line 40, in <module>
       class TaskOutletDatasetReferencePydantic(BaseModelPydantic):
     File "/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 95, in __new__
       private_attributes = inspect_namespace(
     File "/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 328, in inspect_namespace
       raise PydanticUserError(
   pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `dag_id = <class 'str'>`. All model fields require a type annotation; if `dag_id` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.
   ```
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   1. install `apache-airflow` via pip 
   2. open terminal, cd to `~/airflow` folder
   3. run `airflow db init` command
   
   ### Operating System
   
   MacOS Ventura 13.3.1.
   
   ### Versions of Apache Airflow Providers
   
   **apache-airflow-providers-common-sql==1.5.2
   apache-airflow-providers-ftp==3.4.2
   apache-airflow-providers-http==4.4.2
   apache-airflow-providers-imap==3.2.2
   apache-airflow-providers-sqlite==3.4.2**
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

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


[GitHub] [airflow] tirkarthi commented on issue #32316: Pydantic error when setting up airflow db using airflow db init

Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #32316:
URL: https://github.com/apache/airflow/issues/32316#issuecomment-1616663338

   Can you please share the pydanctic version used `pip freeze | grep pydantic` ? There was recent report of 2.0 release breaking Airflow tests in CI https://github.com/apache/airflow/issues/32311


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] boring-cyborg[bot] commented on issue #32316: Pydantic error when setting up airflow db using airflow db init

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #32316:
URL: https://github.com/apache/airflow/issues/32316#issuecomment-1616631068

   Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on issue #32316: Pydantic error when setting up airflow db using airflow db init

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #32316:
URL: https://github.com/apache/airflow/issues/32316#issuecomment-1616704048

   Closing as duplicate.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] TimothyWillard commented on issue #32316: Pydantic error when setting up airflow db using airflow db init

Posted by "TimothyWillard (via GitHub)" <gi...@apache.org>.
TimothyWillard commented on issue #32316:
URL: https://github.com/apache/airflow/issues/32316#issuecomment-1616682088

   I had a similar issue and the temporary fix I used in the meantime was to restrict the pydantic version to `pydantic>=1.10.0,<2`.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on issue #32316: Pydantic error when setting up airflow db using airflow db init

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #32316:
URL: https://github.com/apache/airflow/issues/32316#issuecomment-1616703896

   You should use constraints if you want to install airflow from the scratch. This is the root cause of the problem. Constraints is the mechanism we introduced. Precisely to handle those kind of breaking changes that our dependencies can introduce. See https://airflow.apache.org/docs/apache-airflow/stable/installation/installing-from-pypi.html where you will find that using constraints is the only recommended and supported way of reproducible installation of airflow (and then you can add other dependencies as you need).


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] tirkarthi commented on issue #32316: Pydantic error when setting up airflow db using airflow db init

Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #32316:
URL: https://github.com/apache/airflow/issues/32316#issuecomment-1616669625

   Duplicate of https://github.com/apache/airflow/issues/32301


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk closed issue #32316: Pydantic error when setting up airflow db using airflow db init

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #32316: Pydantic error when setting up airflow db using airflow db init
URL: https://github.com/apache/airflow/issues/32316


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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