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

   ### Apache Airflow version
   
   2.10.5
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   I am running Airflow using Docker, following the instructions for installing 
Apache Airflow on Debian 12.8 x64. However, when I create a file in the "dags" 
folder of my project, I encounter an error in the Airflow webserver container.
   
   
![Image](https://github.com/user-attachments/assets/946b97d0-c4ac-4a94-84de-024637ef6873)
   
   ```bash
    from airflow.providers.postgres.operators.postgres import PostgresOperator
   ModuleNotFoundError: No module named 'airflow.providers.postgres.operators'
   ```
   
   ### What you think should happen instead?
   
   I should be able to view my file (user_processing.py) in the list DAGs
   
   ### How to reproduce
   
   When I attempted to execute this:
   
   ```python
   from datetime import datetime
   from airflow import DAG 
   from airflow.providers.postgres.operators.postgres import PostgresOperator
   
   with DAG('user_processing', start_date=datetime(2024, 2,28), 
schedule_interval='@daily', catchup=False) as dag:
   
       create_table =PostgresOperator(
           task_id='create_table',
           postgres_conn_id='postgres',
           sql='''
               CREATE TABLE IF NOT EXISTS users(
               firstname TEXT NOT NULL,
               lastname TEXT NOT NULL,
               country TEXT NOT NULL,
               username TEXT NOT NULL,
               password TEXT NOT NULL,
               email TEXT NOT NULL
               );
           '''
       )
   ```
   
   ### Operating System
   
   PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" 
VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian 
HOME_URL="https://www.debian.org/"; SUPPORT_URL="https://www.debian.org/support"; 
BUG_REPORT_URL="https://bugs.debian.org/";
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   This is a part of the log:
   
   
   ```bash
   " 200 -
   airflow-webserver-1  | 127.0.0.1 - - [28/Feb/2025:06:59:30 +0000] "GET 
/health HTTP/1.1" 200 318 "-" "curl/7.88.1"
   airflow-scheduler-1  | [2025-02-28T06:59:33.703+0000] {processor.py:401} 
WARNING - Error when trying to pre-import module 
'airflow.providers.postgres.operators.postgres' found in 
/opt/airflow/dags/user_processing.py: No module named 
'airflow.providers.postgres.operators'
   airflow-scheduler-1  | 127.0.0.1 - - [28/Feb/2025 06:59:55] "GET /health 
HTTP/1.1" 200 -
   airflow-webserver-1  | 127.0.0.1 - - [28/Feb/2025:07:00:00 +0000] "GET 
/health HTTP/1.1" 200 318 "-" "curl/7.88.1"
   airflow-scheduler-1  | [2025-02-28T07:00:04.546+0000] {processor.py:401} 
WARNING - Error when trying to pre-import module 
'airflow.providers.postgres.operators.postgres' found in 
/opt/airflow/dags/user_processing.py: No module named 
'airflow.providers.postgres.operators'
   airflow-triggerer-1  | [2025-02-28T07:00:13.312+0000] 
{triggerer_job_runner.py:510} INFO - 0 triggers currently running
   airflow-scheduler-1  | 127.0.0.1 - - [28/Feb/2025 07:00:25] "GET /health 
HTTP/1.1" 200 -
   airflow-webserver-1  | 127.0.0.1 - - [28/Feb/2025:07:00:30 +0000] "GET 
/health HTTP/1.1" 200 318 "-" "curl/7.88.1"
   airflow-scheduler-1  | [2025-02-28T07:00:35.427+0000] {processor.py:401} 
WARNING - Error when trying to pre-import module 
'airflow.providers.postgres.operators.postgres' found in 
/opt/airflow/dags/user_processing.py: No module named 
'airflow.providers.postgres.operators'
   airflow-scheduler-1  | 127.0.0.1 - - [28/Feb/2025 07:00:55] "GET /health 
HTTP/1.1" 200 -
   airflow-webserver-1  | 127.0.0.1 - - [28/Feb/2025:07:01:00 +0000] "GET 
/health HTTP/1.1" 200 318 "-" "curl/7.88.1"
   airflow-scheduler-1  | [2025-02-28T07:01:05.707+0000] {processor.py:401} 
WARNING - Error when trying to pre-import module 
'airflow.providers.postgres.operators.postgres' found in 
/opt/airflow/dags/user_processing.py: No module named 
'airflow.providers.postgres.operators'
   airflow-triggerer-1  | [2025-02-28T07:01:13.363+0000] 
{triggerer_job_runner.py:510} INFO - 0 triggers currently running
   airflow-scheduler-1  | 127.0.0.1 - - [28/Feb/2025 07:01:25] "GET /health 
HTTP/1.1" 200 -
   airflow-webserver-1  | 127.0.0.1 - - [28/Feb/2025:07:01:31 +0000] "GET 
/health HTTP/1.1" 200 318 "-" "curl/7.88.1"
   airflow-scheduler-1  | [2025-02-28T07:01:36.063+0000] {processor.py:401} 
WARNING - Error when trying to pre-import module 
'airflow.providers.postgres.operators.postgres' found in 
/opt/airflow/dags/user_processing.py: No module named 
'airflow.providers.postgres.operators'
   airflow-scheduler-1  | 127.0.0.1 - - [28/Feb/2025 07:01:55] "GET /health 
HTTP/1.1" 200 -
   airflow-webserver-1  | 127.0.0.1 - - [28/Feb/2025:07:02:01 +0000] "GET 
/health HTTP/1.1" 200 318 "-" "curl/7.88.1"
   airflow-scheduler-1  | [2025-02-28T07:02:06.490+0000] {processor.py:401} 
WARNING - Error when trying to pre-import module 
'airflow.providers.postgres.operators.postgres' found in 
/opt/airflow/dags/user_processing.py: No module named 
'airflow.providers.postgres.operators'
   
   ```
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to