pg_config executable not found

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rex Maughan
    Senior Member
    • Mar 2022
    • 213

    pg_config executable not found

    VPS Hosting
    Hi,
    I am having trouble installing psycopg2 on my Linux VPS Hosting. I get the following error when I try to pip install psycopg2:

    Error: pg_config executable not found.

    Can anyone help?
  • Clay Page
    Senior Member
    • Sep 2022
    • 127

    #2
    Your pg_config is missing; follow this:

    Install PostgreSQL development packages:

    Debian/Ubuntu:

    sudo apt update

    sudo apt install postgresql postgresql-contrib libpq-dev

    RHEL/CentOS:

    sudo yum install postgresql postgresql-devel

    Fedora:

    sudo dnf install postgresql postgresql-devel

    Arch Linux:

    sudo pacman -S postgresql

    Verify pg_config is installed.

    After installing, check if pg_config is available by running:

    which pg_config

    It should return a valid path like /usr/bin/pg_config.

    Now, try installing psycopg2 again:


    pip install psycopg2

    If you still encounter issues, you can install the binary version:

    pip install psycopg2-binary

    (psycopg2-binary comes with precompiled binaries, so it doesn't require pg_config.)

    Comment

    Working...
    X