You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backend subprocess exited when trying to invoke get_requires_for_build_wheel
running egg_info
writing psycopg2.egg-info/PKG-INFO
writing dependency_links to psycopg2.egg-info/dependency_links.txt
writing top-level names to psycopg2.egg-info/top_level.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:
at ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/installation/chef.py:164 in _prepare
160�
161� error = ChefBuildError("\n\n".join(message_parts))
162�
163� if error is not None:
� 164� raise error from None
165�
166� return path
167�
168� def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
Note: This error originates from the build backend, and is likely not a problem with poetry but with psycopg2 (2.9.9) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "psycopg2 (==2.9.9)"'.
The text was updated successfully, but these errors were encountered:
To resolve the issue with the Docker build process failing during the RUN poetry install --no-root step due to the pg_config executable not being found when trying to install psycopg2, you need to install the libpq-dev package, which provides the pg_config executable.
You can modify your Dockerfile to include the installation of libpq-dev as follows:
# Use an official Python runtime as a parent imageFROM python:3.11-slim
# Set the working directory in the containerWORKDIR /app
# Install system dependenciesRUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
make \
libpq-dev \ # Add this line to install libpq-dev
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install PoetryRUN curl -sSL https://install.python-poetry.org | python3 -
RUN apt-get update && apt-get install netcat-openbsd -y
# Add Poetry to PATHENV PATH="/root/.local/bin:$PATH"# Copy the current directory contents into the container at /appCOPY . /app
RUN poetry lock --no-update
# Install Python dependenciesRUN poetry install --no-root
# Add wait-for-it.sh script to the containerCOPY wait-for-it.sh /wait-for-it.sh
RUN chmod +x /wait-for-it.sh
# Make port 8000 available to the world outside this containerEXPOSE 8000
# Copy entrypoint script to the containerCOPY startup.sh /startup.sh
RUN chmod +x /startup.sh
# RUN dos2unix startup.sh# Run the entrypoint scriptCMD ["/startup.sh"]
By adding libpq-dev to the list of system dependencies, the pg_config executable will be available, and the psycopg2 installation should proceed without issues [1].
System Info
Latest code from repo
🐛 Describe the bug
RUN poetry install --no-root
Installing dependencies from lock file
Package operations: 81 installs, 1 update, 0 removals
ChefBuildError
Backend subprocess exited when trying to invoke get_requires_for_build_wheel
running egg_info
writing psycopg2.egg-info/PKG-INFO
writing dependency_links to psycopg2.egg-info/dependency_links.txt
writing top-level names to psycopg2.egg-info/top_level.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
https://www.psycopg.org/docs/install.html).
at ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/installation/chef.py:164 in _prepare
160�
161� error = ChefBuildError("\n\n".join(message_parts))
162�
163� if error is not None:
� 164� raise error from None
165�
166� return path
167�
168� def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
Note: This error originates from the build backend, and is likely not a problem with poetry but with psycopg2 (2.9.9) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "psycopg2 (==2.9.9)"'.
The text was updated successfully, but these errors were encountered: