2

I'm currently looking to build an SSL out-of-the-box Django application, with the help of Lua Open Resty SSL and the valian/docker-nginx-auto-ssl image (See here for reference: https://github.com/Valian/docker-nginx-auto-ssl).

I want to merge the Dockerfile from the above project with one of mine, and I am hitting a snag with installing the python dependecy from my requirements.txt file:

psycopg2-binary==2.8.4

The base OS specified in the valian Dockerfile is Alpine, so OS level dependencies are apk sourced. (FROM openresty/openresty:alpine-fat).

The specific error I am receiving is this:

Collecting psycopg2-binary==2.8.2
  Downloading https://files.pythonhosted.org/packages/dc/93/bb5655730913b88f9068c6b596177d1df83be0d476671199e17b06ea8436/psycopg2-binary-2.8.2.tar.gz (369kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/lib/pyenv/versions/3.8.0/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6t5fbphg/psycopg2-binary/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6t5fbphg/psycopg2-binary/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-6t5fbphg/psycopg2-binary/pip-egg-info
         cwd: /tmp/pip-install-6t5fbphg/psycopg2-binary/
    Complete output (23 lines):
    running egg_info
    creating /tmp/pip-install-6t5fbphg/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info
    writing /tmp/pip-install-6t5fbphg/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-install-6t5fbphg/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info/dependency_links.txt
    writing top-level names to /tmp/pip-install-6t5fbphg/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info/top_level.txt
    writing manifest file '/tmp/pip-install-6t5fbphg/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info/SOURCES.txt'

    Error: pg_config executable not found.

    pg_config is required to build psycopg2 from source.  Please add the directory
    containing pg_config to the $PATH or specify the full executable path with the
    option:

        python setup.py build_ext --pg-config /path/to/pg_config build ...

    or with the pg_config option in 'setup.cfg'.

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

    For further information please check the 'doc/src/install.rst' file (also at
    <http://initd.org/psycopg/docs/install.html>).

    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

This also happens if I use psycopg2==2.8.4.

So, I guess, what would I need to do to provide the container the pg_config executable? Is this something that comes with apk add postgresql?

Related question: pg_config executable not found

Micheal J. Roberts
  • 1,771
  • 12
  • 35

0 Answers0