4

I've installed Apache Airflow version 2.2.4 on my system Ubuntu 20.0.4 LTS and I'm using these steps

  • export AIRFLOW_HOME=~/airflow
  • pip3 install apache-airflow
  • airflow db init
  • airflow users create --username admin --firstname XXXX --lastname XXX --role Admin --email [email protected]

When I'm running my server using this command

  • airflow webserver -p 8080

I've got an error saying

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: session

apacheAirflow

How can I solve this error?

1
  • 1
    yes you can see in step 3 airflow db init Commented Mar 6, 2022 at 13:20

3 Answers 3

5

For me the issue was that I have set the AIRFLOW_HOME on one tab of my terminal, but on the other tab (from where I was running the webserver) I forgot to set it. So the solution is to do the following in ALL TERMINAL TABS that you're using for Airflow:

  1. Activate the virtual environment where your Airflow is installed

    source your_airflow_venv/bin/activate
    
  2. Navigate to the directory where your Airflow project is

    cd /path_to_your_airflow_dir
    
  3. Update your AIRFLOW_HOME environment variable

    export AIRFLOW_HOME=$(pwd)
    
  4. Initialize the Airflow database

    airflow db init
    
  5. Start the Airflow Web Server or the Airflow Scheduler (depending on which terminal tab you currently are)

    airflow scheduler
    airflow webserver
    
Sign up to request clarification or add additional context in comments.

Comments

0

Before running webserver using command airflow webserver, make sure to set AIRFLOW_HOME using below command:

 export AIRFLOW_HOME="your_airflow_directory"

10 Comments

i did try this still getting the same error?
Then try doing a db reset using command : airflow db reset after setting the above. variable. and try doing the airflow db init. Also. make sure to set same AIRFLOW_HOME before running these commands
it's not working geeting the same result again seems like there is some problem with session id? [SQL: SELECT session.id AS session_id_1, session.session_id AS session_session_id, session.data AS session_data, session.expiry AS session_expiry FROM session WHERE session.session_id = ? LIMIT ? OFFSET ?] [parameters: ('347fde8a-01bc-4074-9f3c-87f1dc7ec4de', 1, 0)] (Background on this error at: http://sqlalche.me/e/13/e3q8)
try a fresh installation, that would be last resort
I did I installed it again using a different directory but still getting the same error? I don't know what when wrong? I can't even find solution online
|
0

I had the same error message. I made the mistake and naively installed airflow through pip.

I fixed the issue by deleting the directory AIRFLOW_HOME points to and reinstalling airflow through pip with a constraint. Then I initiated the automated airflow setup with the airflow standalone command.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.