testdrivenio / testdriven-app-2.4

23 stars 8 forks source link

Error: pg_config executable not found #12

Closed ghost closed 5 years ago

ghost commented 5 years ago

Postgres Setup

Part 1, Chapter 7

After following all instructions I do:

$ chmod +x services/users/entrypoint.sh $ docker-compose -f docker-compose-dev.yml up -d --build

and get the following:

Building users-db
Step 1/2 : FROM postgres:11.1-alpine
 ---> b43856647ab5
Step 2/2 : ADD create.sql /docker-entrypoint-initdb.d
 ---> Using cache
 ---> 3074f2692270

Successfully built 3074f2692270
Successfully tagged testdriven-app_users-db:latest
Building users
Step 1/9 : FROM python:3.7.2-alpine
 ---> 2d23e3e6584b
Step 2/9 : RUN mkdir -p /usr/src/app
 ---> Using cache
 ---> 846682ea9fdc
Step 3/9 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 616e7573cbf9
Step 4/9 : COPY ./requirements.txt /usr/src/app/requirements.txt
 ---> Using cache
 ---> 6b595321273b
Step 5/9 : RUN pip install -r requirements.txt
 ---> Running in 85c326cd6d8a
Collecting Flask==1.0.2 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl (91kB)
Collecting Flask-SQLAlchemy==2.3.2 (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/a1/44/294fb7f6bf49cc7224417cd0637018db9fee0729b4fe166e43e2bbb1f1c8/Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl
Collecting psycopg2-binary==2.7.6.1 (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/59/64/7b0fea58c9b7c609717cc951607fe5edb73e86d46a47b0c7d58586335e53/psycopg2-binary-2.7.6.1.tar.gz (428kB)
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2_binary.egg-info
    writing pip-egg-info/psycopg2_binary.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/psycopg2_binary.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/psycopg2_binary.egg-info/top_level.txt
    writing manifest file '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>).

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-5wr75u4j/psycopg2-binary/
ERROR: Service 'users' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

I've overcome this by following this solution:

https://stackoverflow.com/questions/46711990/error-pg-config-executable-not-found-when-installing-psycopg2-on-alpine-in-dock

Enjoying this course a lot, life saviour!!

mjhea0 commented 5 years ago

Thanks for sharing! Feel free to reach out via email if you run into more issues in the future. michael at mherman dot org. Cheers!