docker-airflow: libpq error
I get the following error when building image myself using docker build --rm --build-arg AIRFLOW_DEPS="datadog,dask" --build-arg PYTHON_DEPS="flask_oauthlib>=0.9" -t agiz/docker-airflow:1.10.2 .:
ImportError: libpq.so.5: cannot open shared object file: No such file or directory
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 6
- Comments: 24
Commits related to this issue
- Revert version to 1.10.1 to work around https://github.com/puckel/docker-airflow/issues/342 — committed to ScaleFactor/docker-airflow by JoalW 5 years ago
- updates to run as of https://github.com/puckel/docker-airflow/issues/342 — committed to frankcash/airflow_compose by deleted user 5 years ago
By adding below two library problem is resolved on mac but still facing the issue on Linux 'pip install psycopg2
&& pip install psycopg2-binary ’
I added libpq5 and the issue cleared up. Be mindful not to add it to the buildDeps section, as all of those libraries are removed at the end of the build.
Yes, just like @hbeadles is saying. Also in Airflow in your task log you see: “The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use “pip install psycopg2-binary” instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.”
I can confirm this error. When building an image with the provided Dockerfile I see the following error when the image is run:
@paulforan I can take a shot at answering. So from version 2.8 forward, psycopg2 no longer bundles binary packages. It bundles those separately in a new packages - psycopg2-binary. More information on the change can be found here: http://initd.org/psycopg/articles/2018/02/08/psycopg-274-released/. If you included postgres in that apache-airflow pip install line, it installs the newest version of postgres, (2.8.2), which does not have the binary packages included anymore. So to get around that, just remove postgres from there and install psycopg2-binary separately to get those dependencies included. More information can be found here – https://github.com/puckel/docker-airflow/pull/349
This worked for me:
pip install psycopg2-binary redis>=3.2.0, which you can set withPYTHON_DEPS.Yes This worked in my case, Thanks
Same issue. Faced it today.
[2019-07-08 08:29:15,214] {{settings.py:174}} INFO - settings.configure_orm(): Using pool settings. pool_size=5, pool_recycle=1800, pid=1 Traceback (most recent call last): File “/usr/local/bin/airflow”, line 21, in <module> from airflow import configuration File “/usr/local/lib/python3.6/site-packages/airflow/init.py”, line 36, in <module> from airflow import settings, configuration as conf File “/usr/local/lib/python3.6/site-packages/airflow/settings.py”, line 266, in <module> configure_orm() File “/usr/local/lib/python3.6/site-packages/airflow/settings.py”, line 188, in configure_orm engine = create_engine(SQL_ALCHEMY_CONN, **engine_args) File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/init.py”, line 443, in create_engine return strategy.create(*args, **kwargs) File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py”, line 87, in create dbapi = dialect_cls.dbapi(**dbapi_args) File “/usr/local/lib/python3.6/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py”, line 599, in dbapi import psycopg2 File “/usr/local/lib/python3.6/site-packages/psycopg2/init.py”, line 50, in <module> from psycopg2._psycopg import ( # noqa ImportError: libpq.so.5: cannot open shared object file: No such file or directory
========== && pip install psycopg2==2.7.7
This fix helps me.
Probably another version conflict. In fact on my side I specified all the package versions: