Need help?

Our experts have had an average response time of 13.14 minutes in February 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Error: pg_config executable not found | How to fix

by | Jan 9, 2022

Wondering how to resolve Error: pg_config executable not found? We can help you.

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Service.

Today, let’s take a look at how our Support Team help a customer deal with this error.

 

How to resolve Error: pg_config executable not found?

Typically, error looks as shown below:

Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH

Today, let us see the different methods followed by our Support Techs to resolve this error.

Firstly, you need to install libpq-dev and python-dev ( python-dev is optional ).

Then, you can run pip install psycopg2 this command. Just run this command to install the above two mentioned packages.

If you face Python.h: No such file or directory this error then just install python3-dev.

 

Solution 1

First of all you need to install libpq-dev and python-dev ( python-dev is optional ).

Then, you can run pip install psycopg2 this command.

Just run this command to install above two mentioned packages.

sudo apt-get install libpq-dev python-dev

If you face Python.h: No such file or directory this error then just install python3-dev

 

Solution 2

On macOS just run below command with the homebrew package manager.

brew install postgresql

 

Solution 3

For CentOS, first install

sudo yum install postgresql postgresql-devel python-devel

For Ubuntu just use the equivilent apt-get packages.

sudo apt-get install postgresql postgresql-dev python-dev

And then dont forgot to add in path variable. Just run below command.

Then, make sure to include the correct path.

sudo PATH=$PATH:/usr/pgsql-9.3/bin/ pip install psycopg2

 

[Need a solution to another query? We are just a click away.]

 

Conclusion

Today, we saw steps followed by our Support Engineers in order to resolve Error: pg_config executable not found

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

10 Comments

  1. bee cool

    Sweet!!! you save my life!

    Reply
  2. Shubham Bairagi

    In the Mac M1 I run the above command but still it’s not installing in vartualenv any suggestions will be appreciated.

    Reply
    • Hiba Razak

      Hi,
      Our Experts can help you with the issue, we’ll be happy to talk to you on chat (click on the icon at right-bottom).

      Reply
  3. Nimra Tahir

    while running commands on ubuntu getting this error

    E: Unable to locate package postgresql-dev
    E: Package ‘python-dev’ has no installation candidate

    Reply
    • Hiba Razak

      Hi,
      Please contact our support team via live chat(click on the icon at right-bottom).

      Reply
  4. Shoaib nawaz

    what is solution for windows ?

    Reply
    • Hiba Razak

      Hi,
      Please contact our support through live chat(click on the icon at right-bottom).

      Reply
  5. julieta

    En windows, use python3.11 y se me fue el error y pip 23.2.1

    Reply
  6. Joe

    brew install postgresql worked for me on 2023 Macbook Air with M2 Apple Silicon processor – thank you!

    Reply
    • Hiba Razak

      Hi Joe,
      Thanks for the feedback. We are glad to know that our article was helpful for you 🙂 .

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF