Psycoppg2 error in local M1 Mac docker build
Closed this issue · 3 comments
Describe the bug
Unable to run Request Broker locally in docker container because of a psycopg2 error.
To reproduce
Steps to reproduce the behavior:
- Use M1 Mac
- Run
docker-compose up
- See error:
request-broker-web_1 | psycopg2.OperationalError: SCRAM authentication requires libpq version 10 or above
Expected behavior
Program to build and run in docker container with no errors.
Impact on your work
I changed the postgres version in docker-compose.yml
to 13.3, which allowed me to run locally with no errors, so it's not blocking my work:
request-broker-db:
image: postgres:13.3
Additional context
This appears to be related to this issue described in the psycopg2 repo.
As noted here another band-aid solution is to run export DOCKER_DEFAULT_PLATFORM=linux/amd64
, and re-build your images. This results in a performance hit (although it was not immediately noticeable to me).
Attempted to use psycopg2
instead of psycopg2-binary
results in an error on deploy (which could potentially be resolved server-side:
[stderr] Error: pg_config executable not found.
[stderr]
[stderr] pg_config is required to build psycopg2 from source. Please add the directory
[stderr] containing pg_config to the $PATH or specify the full executable path with the
[stderr] option:
[stderr]
[stderr] python setup.py build_ext --pg-config /path/to/pg_config build ...
[stderr]
[stderr] or with the pg_config option in 'setup.cfg'.
[stderr]
[stderr] If you prefer to avoid building psycopg2 from source, please install the PyPI
[stderr] 'psycopg2-binary' package instead.
[stderr]
[stderr] For further information please check the 'doc/src/install.rst' file (also at
[stderr] <https://www.psycopg.org/docs/install.html>).
This has been resolved across all VMs by installing postgresql-devel
library.