Keywords: Apache Airflow - Microsoft Azure - How to - Other
Description:
We have installed Apache Airflow on AKS using bitnami helm chart. App is running fine. For enabling Azure SQL connectivity from a DAG (say to execute some queries as part of DAG), we are trying to create a custom sql hook using pyodbc library. This library is not installed by default on Airflow containers using default image. When trying to install using pip3 install command, getting below errors. Can someone point to us if we are doing anything wrong.
COMMAND WE ARE USING
kubectl exec -c -- /opt/bitnami/airflow/venv/bin/pip3 install pyodbc
ERROR
Collecting pyodbc
Downloading pyodbc-4.0.30.tar.gz (266 kB)
Using legacy 'setup.py install' for pyodbc, since package 'wheel' is not installed.
Installing collected packages: pyodbc
Running setup.py install for pyodbc: started
Running setup.py install for pyodbc: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /opt/bitnami/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l5jtgxaj/pyodbc/setup.py'"'"'; file='"'"'/tmp/pip-install-l5jtgxaj/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-286fszn7/install-record.txt --single-version-externally-managed --compile --install-headers /opt/bitnami/python/include/python3.6m/pyodbc
cwd: /tmp/pip-install-l5jtgxaj/pyodbc/
Complete output (10 lines):
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -s -s -fPIC -DPYODBC_VERSION=4.0.30 -I/opt/bitnami/python/include/python3.6m -c src/buffer.cpp -o build/temp.linux-x86_64-3.6/src/buffer.o -Wno-write-strings
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
ERROR: Command errored out with exit status 1: /opt/bitnami/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l5jtgxaj/pyodbc/setup.py'"'"'; file='"'"'/tmp/pip-install-l5jtgxaj/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-286fszn7/install-record.txt --single-version-externally-managed --compile --install-headers /opt/bitnami/python/include/python3.6m/pyodbc Check the logs for full command output.
command terminated with exit code 1