I have followed the steps to install Airflow from below link
Airflow installation and getting this below error
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 25, in <module>
from airflow.configuration import conf
File "/usr/local/lib/python3.5/dist-packages/airflow/__init__.py", line 42, in <module>
from airflow.models import DAG
File "/usr/local/lib/python3.5/dist-packages/airflow/models/__init__.py", line 21, in
<module>
from airflow.models.baseoperator import BaseOperator, BaseOperatorLink # noqa: F401
File "/usr/local/lib/python3.5/dist-packages/airflow/models/baseoperator.py", line 30, in
<module>
from typing import Any, Callable, ClassVar, Dict, FrozenSet, Iterable, List, Optional,
Set, Type, Union
ImportError: cannot import name 'ClassVar'
Can somebody help me here
I encountered the same error as well in my case:
After some checking, I found it was a python version issue that the python3.5 doesn't support the module typing.ClassVar: https://docs.python.org/3.5/library/typing.html
As introduced in PEP 526, a variable annotation wrapped in ClassVar indicates that a given attribute is intended to be used as a class variable and should not be set on instances of that class.
And checked in PEP 526 I found this feature only support from 3.6, oh....
Thus the solution was to upgrade the Python version to 3.6+ to install Airflow 1.10.
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.7
sudo apt install build-essential libssl-dev libffi-dev python3.7-dev
sudo apt-get install python3.7-venv
After all above, the processes executed successfully. As a perfection for the official guide, the environment requirement for installation will be:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With