rr- / szurubooru

Image board engine, Danbooru-style.
GNU General Public License v3.0
704 stars 178 forks source link

Can't install on Raspberry Pi, "pg_config executable not found" #238

Closed SamusAranX closed 5 years ago

SamusAranX commented 5 years ago

Running docker-compose build --pull results in this output:

~/szuru $ docker-compose build --pull
elasticsearch uses an image, skipping
sql uses an image, skipping
Building api
Step 1/18 : FROM scratch as approot
 --->
Step 2/18 : WORKDIR /opt/app
 ---> Using cache
 ---> d0140ed936ec
Step 3/18 : COPY alembic.ini wait-for-es generate-thumb ./
 ---> Using cache
 ---> f8016191941e
Step 4/18 : COPY szurubooru/ ./szurubooru/
 ---> Using cache
 ---> 704cd6501994
Step 5/18 : COPY config.yaml.dist ./
 ---> Using cache
 ---> 04b6dbfa3b0e
Step 6/18 : FROM python:3.6-slim
3.6-slim: Pulling from library/python
Digest: sha256:90167f0d52404dfdd9e4c4ea17f2623571f8e51be0ac230325f77b9f2b401adf
Status: Image is up to date for python:3.6-slim
 ---> ecef46314207
Step 7/18 : WORKDIR /opt/app
 ---> Using cache
 ---> e8f3d72c85f9
Step 8/18 : ARG PUID=1000
 ---> Using cache
 ---> 1ef4c077f4e1
Step 9/18 : ARG PGID=1000
 ---> Using cache
 ---> bd0cc58554d5
Step 10/18 : ARG PORT=6666
 ---> Using cache
 ---> f36353e8dc18
Step 11/18 : RUN     mkdir -p /opt/app /data &&     groupadd -g ${PGID} app &&     useradd -d /opt/app -M -c '' -g app -r -u ${PUID} app &&     chown -R app:app /opt/app /data &&     echo "#!/bin/sh" >> /init &&     echo "set -e" >> /init &&     echo "cd /opt/app" >> /init &&     echo "./wait-for-es" >> /init &&     echo "alembic upgrade head" >> /init &&     echo "exec waitress-serve --port ${PORT} szurubooru.facade:app"         >> /init &&     chmod a+x /init &&     apt-get -yqq update &&     apt-get -yq install --no-install-recommends ffmpeg &&     rm -rf /var/lib/apt/lists/* &&     pip3 install --no-cache-dir waitress
 ---> Using cache
 ---> 631afb955f9e
Step 12/18 : COPY --chown=app:app requirements.txt ./requirements.txt
 ---> Using cache
 ---> c9bb4354fd36
Step 13/18 : RUN pip3 install --no-cache-dir -r ./requirements.txt
 ---> Running in b3b814ed5f81
Collecting alembic>=0.8.5 (from -r ./requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/d6/bb/ec1e21f2e303689ad2170eb47fc67df9ad4199ade6759a99474c4d3535c8/alembic-1.0.8.tar.gz (1.0MB)
Collecting pyyaml>=3.11 (from -r ./requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d/PyYAML-5.1.tar.gz (274kB)
Collecting psycopg2-binary>=2.6.1 (from -r ./requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/a6/fb/158c6f1dfcc0f0ceb4c3687378b965269079e55de5630c173dd163c6ab21/psycopg2-binary-2.8.1.tar.gz (368kB)
    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-bmxccxfh/psycopg2-binary/
ERROR: Service 'api' failed to build: The command '/bin/sh -c pip3 install --no-cache-dir -r ./requirements.txt' returned a non-zero code: 1

What's happening here? I'm not familiar enough with Docker to attempt to fix this myself, so help would be appreciated.

sgsunder commented 5 years ago

The Docker stuff will only work on x86-64 (Intel/AMD 64bit) the way it's written in the repo. But someone else managed to modify it to work on the Pi:

https://github.com/rr-/szurubooru/issues/192#issuecomment-476897156

Not sure if it works but it's worth a shot

SamusAranX commented 5 years ago

Yeah, replacing my server/Dockerfile with theirs made it work. This should probably be part of the repository.