benji2092
benji2092

Reputation: 53

Apache Airflow 1.9 install on debian 8 from GitHub

I installed Apache airflow 1.9 from GitHub thanks to this command line on debian 9: pip install git+https://github.com/apache/incubator-airflow.git@v1-9-stable

However, I have an error during the airflow initdb caused by Fernet, do you know how to solve this issue?

   INFO  [alembic.runtime.migration] Running upgrade 947454bf1dff -> d2ae31099d61, Increase text size for MySQL (not relevant for other DBs' text types)
    [2017-12-27 17:19:24,586] {models.py:643} ERROR - Failed to load fernet while encrypting value, using non-encrypted value.
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/airflow/models.py", line 639, in set_extra
        fernet = get_fernet()
      File "/usr/local/lib/python2.7/dist-packages/airflow/models.py", line 103, in get_fernet
        raise AirflowException('Failed to import Fernet, it may not be installed')
    AirflowException: Failed to import Fernet, it may not be installed
    [2017-12-27 17:19:24,601] {models.py:643} ERROR - Failed to load fernet 

And how can I specify extrapackage like in pip install apache-airflow[gcp-api] from my previous pip command install with GitHub?

How to install the latest 1.9.0RC too? I have an assertionError.

Upvotes: 2

Views: 3193

Answers (3)

benji2092
benji2092

Reputation: 53

During install from source you have to replace fernet_key in airflow.cfg such as you can find in the docs here.

Upvotes: 1

Thilina Madumal
Thilina Madumal

Reputation: 101

In apache-airflow documentation, the script for generating fernet key is apparently wrong. it says to use the following script.

from cryptography.fernet import Fernet
fernet_key= Fernet.generate_key()
print(fernet_key) # your fernet_key, keep it in secured place!

but it raises an exception at 'airflow initdb' command. to solve this instead of Fernet.generate_key() use Fernet.generate_key().decode() as shown in @skozz answer.

Upvotes: 0

skozz
skozz

Reputation: 2720

The answer marked as good have a broken link, if you have landed here as me and it continues broken, these steps have worked for me:

  • pip install cryptography
  • python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
  • Add the generated key to the config file airflow.cfg, fernet_key = YOUR_GENERATED_KEY

Upvotes: 8

Related Questions