Skip to content

Error: pg_config executable not found.  #13

@azataiot

Description

@azataiot

While following the official tutorial exactly ass it is here https://docs.docker.com/language/python/containerize/, following error occurs while building the image.

MacOS version: Sonoma 14.4.1

1.750 Collecting psycopg2-binary==2.9.6 (from -r requirements.txt (line 8))
1.752   Using cached psycopg2-binary-2.9.6.tar.gz (384 kB)
1.777   Preparing metadata (setup.py): started
2.182   Preparing metadata (setup.py): finished with status 'error'
2.185   error: subprocess-exited-with-error
2.185   
2.185   × python setup.py egg_info did not run successfully.
2.185   │ exit code: 1
2.185   ╰─> [23 lines of output]
2.185       running egg_info
2.185       creating /tmp/pip-pip-egg-info-bfqpig1e/psycopg2_binary.egg-info
2.185       writing /tmp/pip-pip-egg-info-bfqpig1e/psycopg2_binary.egg-info/PKG-INFO
2.185       writing dependency_links to /tmp/pip-pip-egg-info-bfqpig1e/psycopg2_binary.egg-info/dependency_links.txt
2.185       writing top-level names to /tmp/pip-pip-egg-info-bfqpig1e/psycopg2_binary.egg-info/top_level.txt
2.185       writing manifest file '/tmp/pip-pip-egg-info-bfqpig1e/psycopg2_binary.egg-info/SOURCES.txt'
2.185       
2.185       Error: pg_config executable not found.
2.185       
2.185       pg_config is required to build psycopg2 from source.  Please add the directory
2.185       containing pg_config to the $PATH or specify the full executable path with the
2.185       option:
2.185       
2.185           python setup.py build_ext --pg-config /path/to/pg_config build ...
2.185       
2.185       or with the pg_config option in 'setup.cfg'.
2.185       
2.185       If you prefer to avoid building psycopg2 from source, please install the PyPI
2.185       'psycopg2-binary' package instead.
2.185       
2.185       For further information please check the 'doc/src/install.rst' file (also at
2.185       <https://www.psycopg.org/docs/install.html>).
2.185       
2.185       [end of output]
2.185   
2.185   note: This error originates from a subprocess, and is likely not a problem with pip.
2.186 error: metadata-generation-failed
2.186 
2.186 × Encountered error while generating package metadata.
2.186 ╰─> See above for output.
2.186 
2.186 note: This is an issue with the package mentioned above, not pip.
2.186 hint: See above for details.
------
failed to solve: process "/bin/sh -c python -m pip install -r requirements.txt" did not complete successfully: exit code: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions