Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: pg_config executable not found while building docker-compose #1281

Open
Rishabh952008 opened this issue Jul 17, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@Rishabh952008
Copy link

System Info

pandasai version: 2.2.10
python version:3.11.5
windows 11 version: 23H2Windows

🐛 Describe the bug

pg_config executable not found error is coming during docker-compose build after forking and cloning repo
image
I created a virtual env and then ran this command and even due to this error I tried installing pip install psycopg2-binary==2.9.6
and even tried updating in pyproject.toml then also facing same error

@dosubot dosubot bot added the bug Something isn't working label Jul 17, 2024
Copy link

dosubot bot commented Jul 17, 2024

Hey there, @Rishabh952008! 👋 I'm here to help you with any bugs or questions you have regarding the repository. Let's squash those bugs together!

To resolve the "pg_config executable not found" error when building the Docker Compose setup, you need to ensure that the necessary PostgreSQL development packages are installed. This error typically occurs because the system is missing the pg_config tool, which is required to build PostgreSQL extensions or dependencies.

Here is how you can resolve this issue:

  1. Install PostgreSQL Development Packages: You need to install the PostgreSQL development packages on your system. The package name may vary depending on your operating system.

    For Debian-based systems (like Ubuntu), you can use:

    sudo apt-get update
    sudo apt-get install libpq-dev

    For Red Hat-based systems (like CentOS), you can use:

    sudo yum install postgresql-devel
  2. Rebuild the Docker Images: After installing the necessary packages, you should rebuild the Docker images to ensure that the changes take effect.

    docker-compose build

By installing the PostgreSQL development packages, the pg_config executable will be available, and the Docker Compose setup should build successfully [1].

To continue talking to Dosu, mention @dosu.

@Rishabh952008
Copy link
Author

i have installed postgresql on my windows and added to environment variables but than also dealing with same error. I tried giving path to dockerfile of server and client as well but then another error coming

Copy link

dosubot bot commented Jul 17, 2024

To resolve the pg_config not found error when building the Docker Compose setup for the "PANDAS-AI" project on your Windows 11 system, you need to ensure that the PostgreSQL development packages are installed within the Docker environment itself, not just on your host system.

Here is how you can modify the Dockerfile to include the installation of the PostgreSQL development packages:

  1. Open the Dockerfile used for building the server image.
  2. Add the installation command for the PostgreSQL development packages.

For example, if you are using a Debian-based image, you can add the following line to install the necessary packages:

RUN apt-get update && apt-get install -y postgresql-server-dev-all

Here is a sample modification to the Dockerfile:

FROM python:3.9-slim

# Install dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    libpq-dev \
    postgresql-server-dev-all

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . .

# Command to run the application
CMD ["python", "app.py"]

After making these changes, rebuild your Docker images:

docker-compose build

This should resolve the pg_config not found error [1].

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant