Monday, October 31, 2022

Re: Error: pg_config executable not found. (psycopg2 for postgres in docker not successfully installed)

Hello, fam!

Found a solution to the problem. Updated the Dockerfile. Check below

Thanks, guys...


FROM python:3.8.3-slim



RUN apt-get update \
    && apt-get -y install libpq-dev gcc

COPY ./requirements.txt .
RUN pip install -r requirements.txt

COPY . .
On Saturday, October 29, 2022 at 1:12:22 PM UTC+1 Kasper Laudrup wrote:
On 28/10/2022 12.35, Adeyemi Deji wrote:
> I have tried this command in Dockerfile: RUN pip install --user
> psycopg2==2.9.5
> I got the command on StackOverflow but still didn't resolve the issue.

Seems like you need the postgresql development package or similar to
build psycopg2 from source. Try using the binary package
(psycopg2-binary) instead as suggested here:

> #0 26.78       If you prefer to avoid building psycopg2 from source,
> please install the PyPI
> #0 26.78       'psycopg2-binary' package instead.

Alternatively, ensure the postgresql development package is installed in
your Docker container.

Kind regards,
Kasper Laudrup

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

No comments:

Post a Comment