Raj
Raj

Reputation: 623

How to change Apache Airflow Python path from Python 2.7 to 3?

Initially, I had installed Apache Airflow and python 2.7 is set as default path. Now, I'm trying to change path from 2.7 to 3. Is it possible to do so or do I have re-install the airflow and set the python path? Any pointers would be helpful?

Thanks in advance!

Upvotes: 5

Views: 17024

Answers (2)

Ilya Bystrov
Ilya Bystrov

Reputation: 3056

I had installed Apache Airflow and python 2.7 is set as default path.

Use

pip3 install apache-airflow

instead of

pip install apache-airflow

Upvotes: 1

judoole
judoole

Reputation: 1422

There are a few ways to make sure that you are using the version of Python that you would like. Docker is one, take a look at https://github.com/puckel/docker-airflow for a good example.

Another is to use virtual environments. I've only used Virtualenv with success. I like Pipenv, but unfortunately I ran into some dependency-trouble using it with Airflow.

Anyways, here is an example of what should work with Virtualenv:

cd your-project
virtualenv -p python3 .direnv
source .direnv/bin/activate
pip install -r requirements.txt

python --version should list python 3, and running airflow webserver, should run Airflow in python 3.

Upvotes: 3

Related Questions