Quick Steps to Fix “Error: pg_config executable not found”

sreekutty

Devops

Last Updated: 30 September 2026
Quick Steps to Fix “Error: pg_config executable not found”
🖥️12,400+PCs Fixed
⭐4.9★Google Rating
⚡<15 minAvg. Response
🛡️ISO 27001Certified

How to resolve Error: pg_config executable not found?

If you’re installing a package that depends on PostgreSQL — like psycopg2, pgvector, pg-promise, or other PostgreSQL-related libraries — you might see this frustrating message:

error: pg_config executable not found

This happens because your system cannot find the PostgreSQL development files needed to compile the library.

Don’t worry — the fix is super simple. Here are the quick steps based on your OS.

1. Install PostgreSQL Development Package (Most Common Fix)

Ubuntu / Debian

sudo apt update sudo apt install postgresql postgresql-contrib libpq-dev

CentOS / RHEL / Fedora

sudo dnf install postgresql postgresql-devel

macOS (Homebrew)

brew install postgresql

Windows

Install PostgreSQL from the official installer: https://www.postgresql.org/download/

Check “Add to PATH” during installation.

2. Find pg_config Location Manually

If PostgreSQL is installed, locate it:

which pg_config

or:

find / -name pg_config 2>/dev/null

3. Add pg_config to Your PATH

If you found the path manually, export it:

export PATH=/path/to/pg_config:$PATH

Example on Ubuntu:

export PATH=/usr/lib/postgresql/15/bin:$PATH

4. Reinstall the Package (psycopg2, pgvector, etc.)

Once pg_config is available in your PATH:

pip install psycopg2

or:

npm install pgvector

Related service: Server Management Service - Managed Linux and Windows servers: monitoring, patching, security and 24/7 support.

postgresqlpg_configpython errors

Get the Free Web Server Setup Checklist (PDF)

Nginx, SSL, security headers, and performance tips — the checklist every web project needs at launch.

Web performance or reliability issues costing customers?

Our Web Infrastructure service manages your web servers, SSL, CDN, and Cloudflare configuration — so your site is fast, secure, and always available.

  • Nginx/Apache server management and optimisation
  • SSL certificate installation and auto-renewal
  • Cloudflare WAF, CDN, and DNS management
  • Uptime monitoring with instant incident response
See Pricing Plans →

What our customers say

“Cloudflare kept blocking our customers. CloudHouse audited the rules and fixed it without compromising security. Fast work.”

Sarah K.

E-commerce Manager

“Our website was loading in 8 seconds. After CloudHouse tuned Nginx and Cloudflare, it's under 1.2 seconds.”

Amit V.

Product Manager

Frequently Asked Questions

Yes — 90% of fixes are done over a secure remote session in 15–30 minutes. Our technicians connect safely using industry-standard tools.

Need this done for you?

Server Management Service

Managed Linux and Windows servers: monitoring, patching, security and 24/7 support.

Learn more

Book your free 15-minute diagnosis

A certified technician will call you back within 15 minutes during business hours.

Share this article

Leave a Comment

Comments (0)

Loading comments...