I am having trouble installing psycopg2. I get the following error when I try to pip install psycopg2
:
Error: pg_config executable not found.
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'.
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/psycopg2
But the problem is pg_config
is actually in my PATH
; it runs without any problem:
$ which pg_config
/usr/pgsql-9.1/bin/pg_config
I tried adding the pg_config path to the setup.cfg
file and building it using the source files I downloaded from their website (http://initd.org/psycopg/) and I get the following error message!
Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'
But it is actually THERE!!!
I am baffled by these errors. Can anyone help please?
By the way, I sudo
all the commands. Also I am on RHEL 5.5.
asked Jul 23, 2012 at 19:09
2
pg_config
is in postgresql-devel
(libpq-dev
in Debian/Ubuntu, libpq-devel
on Centos/Fedora/Cygwin/Babun.)
deepwell
19.7k10 gold badges33 silver badges39 bronze badges
answered Aug 20, 2012 at 11:51
TilmanBaumannTilmanBaumann
13.2k2 gold badges14 silver badges10 bronze badges
23
On Mac OS X, I solved it using the homebrew package manager
brew install postgresql
sacuL
48.2k8 gold badges80 silver badges102 bronze badges
answered Jul 9, 2014 at 4:28
azaleaazalea
10.8k3 gold badges34 silver badges44 bronze badges
10
Have you installed python-dev
?
If you already have, try also installing libpq-dev
sudo apt-get install libpq-dev python-dev
From the article: How to install psycopg2 under virtualenv
phoenix
7,3385 gold badges37 silver badges44 bronze badges
answered Jan 20, 2013 at 11:51
thegaurawthegauraw
5,2482 gold badges20 silver badges14 bronze badges
11
Also on OSX. Installed Postgress.app from http://postgresapp.com/ but had the same issue.
I found pg_config
in that app’s contents and added the dir to $PATH
.
It was at /Applications/Postgres.app/Contents/Versions/latest/bin
. So this worked: export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
.
answered Jul 10, 2014 at 19:26
salsburysalsbury
2,6871 gold badge19 silver badges21 bronze badges
3
You can install pre-compiled binaries on any platform with pip
or conda
:
python -m pip install psycopg2-binary
or
conda install psycopg2
Please be advised that the psycopg2-binary pypi page recommends building from source in production:
The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources
To use the package built from sources, use python -m pip install psycopg2
. That process will require several dependencies (documentation) (emphasis mine):
- A C compiler.
- The Python header files. They are usually installed in a package such as
python-dev
. A message such aserror: Python.h: No such file or directory
is an indication that the Python headers are missing.- The libpq header files. They are usually installed in a package such as
libpq-dev
. If you get anerror: libpq-fe.h: No such file or directory
you are missing them.- The
pg_config
program: it is usually installed by thelibpq-dev
package but sometimes it is not in aPATH
directory. Having it in thePATH
greatly streamlines the installation, so try runningpg_config --version
: if it returns an error or an unexpected version number then locate the directory containing thepg_config
shipped with the rightlibpq
version (usually/usr/lib/postgresql/X.Y/bin/
) and add it to thePATH
:$ export PATH=/usr/lib/postgresql/X.Y/bin/:$PATH
You only need
pg_config
to compilepsycopg2
, not for its regular usage.
Once everything is in place it’s just a matter of running the standard:
$ pip install psycopg2
or, from the directory containing the source code:
$ python setup.py build $ python setup.py install
answered Nov 21, 2019 at 21:28
jkrjkr
16k2 gold badges40 silver badges61 bronze badges
4
For ubuntu users, this is the solution:
sudo apt install libpq-dev
It worked for me.
answered Oct 4, 2021 at 18:12
2
On alpine, the library containing pg_config
is postgresql-dev
. To install, run:
apk add postgresql-dev
answered Jul 6, 2017 at 1:16
rkovalrkoval
8588 silver badges12 bronze badges
This is what worked for me on CentOS, first install:
sudo yum install postgresql postgresql-devel python-devel
On Ubuntu just use the equivilent apt-get packages.
sudo apt-get install postgresql postgresql-dev python-dev
And now include the path to your postgresql binary dir with you pip install, this should work for either Debain or RHEL based Linux:
sudo PATH=$PATH:/usr/pgsql-9.3/bin/ pip install psycopg2
Make sure to include the correct path. Thats all
answered Nov 20, 2014 at 15:16
radtekradtek
33.1k11 gold badges141 silver badges110 bronze badges
3
You have to install libpq-dev/postgresql-libs, which is the header files and static library for compiling C programs to link with the libpq library in order to communicate with a PostgreSQL database backend.
On Arch this will run:
$ sudo pacman -S postgresql-libs
On Debian and Ubuntu:
$ sudo apt-get install libpq-dev
On Mac OS X:
$ brew install postgresql
On Red Hat/CentOS/Fedora:
$ sudo yum install postgresql-devel
answered Jan 9, 2021 at 22:27
Mahrez BenHamadMahrez BenHamad
1,6711 gold badge16 silver badges20 bronze badges
1
apt-get build-dep python-psycopg2
answered Feb 8, 2013 at 19:04
matiumatiu
7,2914 gold badges43 silver badges47 bronze badges
0
Just to sum up, I also faced exactly same problem. After reading a lot of stackoverflow posts and online blogs, the final solution which worked for me is this:
1) PostgreSQL(development or any stable version) should be installed before installing psycopg2.
2) The pg_config file (this file normally resides in the bin folder of the PostgreSQL installation folder) PATH had to be explicitly setup before installing psycopg2. In my case, the installation PATH for PostgreSQL is:
/opt/local/lib/postgresql91/
so in order to explicitly set the PATH of pg_config file, I entered following command in my terminal:
PATH=$PATH:/opt/local/lib/postgresql91/bin/
This command ensures that when you try to pip install psycopg2, it would find the PATH to pg_config automatically this time.
I have also posted a full error with trace and its solution on my blog which you may want to refer. Its for Mac OS X but the pg_config PATH problem is generic and applicable to Linux also.
answered Jul 5, 2013 at 6:46
2
You should add python requirements used in Postgres on Ubuntu. Run:
sudo apt-get install libpq-dev python-dev
answered Sep 8, 2017 at 6:54
0
sudo apt-get install libpq-dev
works for me on Ubuntu 15.4
answered Dec 7, 2016 at 22:34
novasaintnovasaint
7008 silver badges13 bronze badges
1
I had this issue because I didn’t had a postgres install. If you have brew install run
brew install postgresql
This should fix the issue.
answered Jul 23, 2021 at 15:03
Rishabh AgarwalRishabh Agarwal
2,1661 gold badge20 silver badges26 bronze badges
1
For those running OS X, this solution worked for me:
1) Install Postgres.app:
http://www.postgresql.org/download/macosx/
2) Then open the Terminal and run this command, replacing where it says {{version}} with the Postgres version number:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/{{version}}/bin
e.g.
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
answered Mar 26, 2015 at 11:11
MiloMilo
1,06711 silver badges16 bronze badges
2
On Linux Mint sudo apt-get install libpq-dev
worked for me.
answered Dec 18, 2017 at 2:13
mthecreatormthecreator
7641 gold badge8 silver badges19 bronze badges
UPDATE /etc/yum.repos.d/CentOS-Base.repo, [base] and [updates] sections
ADD exclude=postgresql*
curl -O http://yum.postgresql.org/9.1/redhat/rhel-6-i386/pgdg-centos91-9.1-4.noarch.rpmr
rpm -ivh pgdg-centos91-9.1-4.noarch.rpm
yum install postgresql
yum install postgresql-devel
PATH=$PATH:/usr/pgsql-9.1/bin/
pip install psycopg2
thefourtheye
229k52 gold badges448 silver badges490 bronze badges
answered Sep 3, 2013 at 10:04
MayankMayank
5,3511 gold badge16 silver badges16 bronze badges
0
Simply run the following:
sudo apt install libpq-dev
Fixed the issue for me
answered Feb 11, 2021 at 9:02
Aric KuterAric Kuter
4153 silver badges11 bronze badges
0
Try to add it to PATH:
PATH=$PATH:/usr/pgsql-9.1/bin/ ./pip install psycopg2
answered Aug 20, 2012 at 12:16
MarboniMarboni
2,3813 gold badges23 silver badges41 bronze badges
4
Ali’s solution worked for me but I was having trouble finding the bin folder location. A quick way to find the path on Mac OS X is to open psql (there’s a quick link in the top menu bar). This will open a separate terminal window and on the second line the path of your Postgres installation will appear like so:
My-MacBook-Pro:~ Me$ /Applications/Postgres93.app/Contents/MacOS/bin/psql ; exit;
Your pg_config file is in that bin folder. Therefore, before installing psycopg2 set the path of the pg_config file:
PATH=$PATH:/Applications/Postgres93.app/Contents/MacOS/bin/
or for newer version:
PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
Then install psycopg2.
answered Dec 31, 2013 at 16:45
user2498172user2498172
2713 silver badges3 bronze badges
2
I’m going to leave this here for the next unfortunate soul who can’t get around this problem despite all the provided solutions. Simply use sudo pip3 install psycopg2-binary
answered Sep 27, 2019 at 10:50
DUDANFDUDANF
2,46110 silver badges38 bronze badges
3
You need to upgrade your pip before installing psycopg2. Use this command
pip install --upgrade pip
answered Mar 10, 2017 at 8:17
AswinAswin
4837 silver badges14 bronze badges
2
On MacOS, the simplest solution will be to symlink the correct binary, that is under the Postgres package.
sudo ln -s /Applications/Postgres.app/Contents/Versions/latest/bin/pg_config /usr/local/bin/pg_config
This is fairly harmless, and all the applications will be able to use it system wide, if required.
answered Aug 4, 2019 at 6:59
C—C—
16.3k6 gold badges53 silver badges59 bronze badges
3
On Mac OS X and If you are using Postgres App (http://postgresapp.com/):
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
No need to specify version of Postgres in this command. It will be always pointed to latest.
and do
pip install psycopg2
P.S: If Changes doesn’t reflect you may need to restart the Terminal/Command prompt
Source
answered Oct 26, 2016 at 6:41
Dinesh SunnyDinesh Sunny
4,5353 gold badges29 silver badges28 bronze badges
Installing python-psycopg2 solved it for me on Arch Linux:
pacman -S python-psycopg2
answered Oct 28, 2016 at 9:07
Ronan BoiteauRonan Boiteau
9,3386 gold badges34 silver badges55 bronze badges
2
Just solved the problem in Cent OS 7 by:
export PATH=$PATH:/usr/pgsql-9.5/bin
make sure your PostgreSql version matches the right version above.
answered Apr 17, 2016 at 18:44
This was partly suggested before, adding it here for clarity.
From the documentation at https://www.psycopg.org/docs/install.html.
they suggest running: $ pip install psycopg2-binary
That solved the issue for me.
answered Sep 24, 2020 at 8:33
Kobi BaracKobi Barac
1112 silver badges4 bronze badges
1
Here, for OS X completeness: if you install PostgreSQL from MacPorts, pg_config will be in /opt/local/lib/postgresql94/bin/pg_config
.
When you installed MacPorts, it already added /opt/local/bin
to your PATH.
So, this will fix the problem:
$ sudo ln -s /opt/local/lib/postgresql94/bin/pg_config /opt/local/bin/pg_config
Now pip install psycopg2
will be able to run pg_config
without issues.
answered Apr 29, 2015 at 18:36
GabiGabi
1,28316 silver badges20 bronze badges
1
To those on macOS Catalina using the zsh
shell who have also installed the postgres app:
Open your ~/.zshrc
file, and add the following line:
export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
Then close all your terminals, reopen them, and you’ll have resolved your problem.
If you don’t want to close your terminals, simply enter source ~/.zshrc
in whatever terminal you’d like to keep working on.
answered Nov 27, 2019 at 0:15
qarthandsoqarthandso
2,0502 gold badges23 silver badges39 bronze badges
1
to avoid having to compile it, however when i run pip install I got the following error messages:
Downloading/unpacking psycopg2-binary (from -r requirements.txt (line 25))
Running setup.py (path:/tmp/pip-build-1xk9772d/psycopg2-binary/setup.py) egg_info for package psycopg2-binary
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
<http://initd.org/psycopg/docs/install.html>).
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2_binary.egg-info
writing top-level names to pip-egg-info/psycopg2_binary.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2_binary.egg-info/dependency_links.txt
writing pip-egg-info/psycopg2_binary.egg-info/PKG-INFO
writing manifest file 'pip-egg-info/psycopg2_binary.egg-info/SOURCES.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
<http://initd.org/psycopg/docs/install.html>).
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-1xk9772d/psycopg2-binary
In this post, we will see How To Fix – “Error: pg_config executable not found” in Python. The most frequent occurrence of this issue is while installing or using psycopg2 & PostgreSQL.
Error: pg_config executable not found. Please add the directory containing pg_config to the PATH or specify the full executable path with the option
Let’s see what pg_config is – pg_config utility prints various configuration parameters with respect to the running version of PostgreSQL. As such it is used by different software, modules or packages while trying to access Postgresql.
First thing first, it is assumed that you had installed postgresql & psycopg2 in the below sequence of order. If this sequence is followed, it is highly unlikely that any error should come.
if( aicp_can_see_ads() ) {
}
- Installed postgresql
- Added postgresql bin dir to PATH variable
- Installed psycopg2
In case the above sequence of order was not adhered to and subsequently you face the error, let’s see how we can identify the root cause and fix the current issue step by step.
Check :
- Check the current postgresql configuration. Use the below command –
eval ./configure 'pg_config --configure'
- As a next step, check if postgresql is correctly been added to the environment PATH variable.
$ which pg_config
- If postgresql binaries are not added to the Path variable while installing postgresql, then add it manually. This will automatically add pg_config to the environment path as well. Check the availability of pg_config file in one of the below location based on your platform. Now assuming you added the postgresql bin to the PATH variable, hence the pg_config file must be accessible . And hopefully the error should be fixed. This is the most basic cause and fix for the issue.
- Windows – ProgramFilesPostgreSQLVersion_Nobin
- Mac – /Applications/Postgres.app/Contents/Versions/<Version_No>/bin
- /Library/PostgreSQL/<Version_No>/bin
- /usr/pgsql-<Version_No>/bin/
Did the above steps help to fix the error ? If yes – Great ! But if not then read on.
If even after the above steps, you are facing the same error, then most probably the issue lies with pycopg2 package installation. Psycopg2 is the database adapter for Postgresql database and is the current stable implementation of this adapter. It is a C extension. And hence it is only compatible with CPython (Not Cython – don’t get confused). CPython is the default and most widely used implementation of the Python language – mostly you are using exactly this version of python itself right now. Hence you would need few additional steps.
if( aicp_can_see_ads() ) {
}
So read on for the next set of check-steps to follow.
Check :
- Did you install pyscopg2 correctly ? Note that – it is a C wrapper around the libpq postgreSQL client library. And hence there are few things that you need to take care of. Use the below steps if not done already.
- Python header files – These are needed for pycopg2. So install these by installing the the package – python-dev or python3-dev as per the python version.
sudo apt-get install python-dev <- for python 2.7 sudo apt-get install python3.5-dev <- python 3.5 sudo apt-get install python3.9-dev <- python 3.9
Note : While doing this step, if you see an error – “Python.h: No such file or directory”, the fix is explained here – How To Fix – fatal error: Python.h: No such file or directory ?
- libpq header files – These are also needed for psycopg2. So install these by installing the package libpq-dev.
sudo apt-get install libpq-dev
if( aicp_can_see_ads() ) {
}
- pg_config – It is installed by the libpq-dev package. But it might get missed from being added to the PATH. Get the path . Generally it is – /usr/lib/postgresql/X.Y/bin/. And then add it to the PATH.
$ export PATH=/usr/lib/postgresql/X.Y/bin/:$PATH
- Assuming you followed the above steps, run the below –
$ pip install psycopg2
Check :
For your ease – this is a quick comprehensive fix if you are not bothered about the extra knowledge and just concerned with the fix.
- Ubuntu –
sudo apt-get install libpq-dev python-dev <- for python 2.7 sudo apt-get install libpq-dev python3.5-dev <- python 3.5 sudo apt-get install libpq-dev python3.9-dev <- python 3.9
- Mac
brew install postgresql
- openSUSE:
zypper in postgresql-devel
- Amazon Linux
yum -y install postgresql-devel
- CentOS
sudo yum install postgresql postgresql-devel python-devel
Additional Info :
Few points you should note and cross-check –
- The current psycopg2 supports –
- Python – 3.6 to 3.9
- PostgreSQL server – 7.4 to 13
- PostgreSQL client – from 9.1
if( aicp_can_see_ads() ) {
}
Hope this helps to fix the error.
Other Interesting Reads –
-
How to Send Large Messages in Kafka ?
-
Fix Spark Error – “org.apache.spark.SparkException: Failed to get broadcast_0_piece0 of broadcast_0”
-
How to Handle Bad or Corrupt records in Apache Spark ?
-
How to use Broadcast Variable in Spark ?
-
Best Practices for Dependency Problem in Spark
-
Sample Code – Spark Structured Streaming vs Spark Streaming
-
Sample Code for PySpark Cassandra Application
-
How to Enable UTF-8 in Python ?
-
How to log an error in Python ?
-
Sample Python Code To Read & Write Various File Formats (JSON, XML, CSV, Text)
-
How to Handle Errors and Exceptions in Python ?
-
How to Handle Bad or Corrupt records in Apache Spark ?
-
How To Fix – Partitions Being Revoked and Reassigned issue in Kafka ?
-
What Are The Most Important Metrics to Monitor in Kafka ?
-
How To Connect Local Python to Kafka on AWS EC2 ?
pg_config executable not found psycopg2 ,pg_config executable not found mac ,error: pg_config executable not found windows ,pg_config executable not found ubuntu ,error pg_config executable not found. centos 7 ,error: pg_config executable not found alpine ,error: pg_config executable not found mac m1 ,error: pg_config executable not found. redhat , , , , ,airflow error pg_config executable not found ,error pg_config executable not found. apt ,pg_config executable not found psycopg2-binary ,error pg_config executable not found. big sur ,error pg_config executable not found. psycopg2-binary ,error pg_config executable not found. docker build ,elastic beanstalk error pg_config executable not found ,pg_config executable not found. pg_config is required to build psycopg2 from source ,pg_config executable not found centos ,error pg_config executable not found. centos 7 ,error pg_config executable not found. centos ,error pg_config executable not found. centos 8 ,psycopg2 pg_config executable not found centos ,error pg_config executable not found. psycopg2 centos , ,pg_config executable not found ,pg_config not found mac ,pg_config command not found ,pg_config executable not found windows ,pg_config executable not found windows 10 ,pg_config executable not found docker ,pg_config executable not found amazon linux ,pg_config executable not found psycopg2-binary ,pg_config executable file not found in $path , ,cygwin error pg_config executable not found ,centos7 error pg_config executable not found ,pg_config executable not found debian ,pg_config executable not found dbt ,error pg_config executable not found. django-heroku ,pg_config executable not found ec2 ,error pg_config executable not found ,error pg_config executable not found. mac ,error pg_config executable not found. docker ,error pg_config executable not found. windows ,error pg_config executable not found windows 10 ,pg_config executable not found fedora ,pg_config executable file not found in $path ,exec pg_config executable file not found in $path ,pg_config executable not found ubuntu ,error pg_config executable not found. ubuntu ,error pg_config executable not found linux ,pg_config executable not found. mac ,pg_config executable not found in windows ,pg_config executable not found in python ,pip3 install pg_config executable not found ,install error pg_config executable not found ,pip install psycopg2 error pg_config executable not found windows ,pip install psycopg2 error pg_config executable not found mac ,jupyter error pg_config executable not found ,jenkins error pg_config executable not found ,error pg_config executable not found. windows 10 ,pg_config executable not found linux ,error pg_config executable not found. psycopg2 linux ,error pg_config executable not found on mac ,pg_config executable not found osx ,error pg_config executable not found on windows ,error pg_config executable not found. opensuse ,odoo error pg_config executable not found ,pg_config executable not found psycopg2 ,pg_config executable not found psycopg2 mac ,pg_config executable not found psycopg2 windows ,pg_config executable not found postgres ,error pg_config executable not found. psycopg2 windows ,error pg_config executable not found. psycopg2 docker ,pg_config executable not found rhel ,error pg_config executable not found. redhat ,error pg_config executable not found rhel ,serverless error pg_config executable not found ,suse error pg_config executable not found ,python slim error pg_config executable not found ,error pg_config executable not found. virtualenv ,pg_config executable not found wsl ,windows python error pg_config executable not found ,pg_config executable not found centos 7 ,pg_config is required to build psycopg2 from source windows ,error pg_config executable not found. mac m1 ,pg_config executable not found macos ,please add the directory containing pg_config to the path windows ,pg_config' is not recognized as an internal or external command ,docker alpine pg_config executable not found ,pg_config executable not found ,pg_config executable not found mac ,pg_config executable not found windows ,pg_config executable not found docker ,pg_config executable not found windows 10 ,pg_config executable not found amazon linux ,pg_config executable not found python ,pg_config executable not found docker ubuntu ,pg_config executable not found redhat ,pg_config executable not found alpine ,pg_config ,pg_config executable not found ,pg_config is required to build psycopg2 ,pg_config command not found ,pg_config tool is not available ,pg_config not found mac ,pg_config path ,pg_config windows ,pg_config macos ,pg_config alpine ,pg_config arch ,pg_config apt-get ,pg_config add to path ,pg_config amazon linux ,pg_config archlinux ,pgadmin config ,pg_config brew ,pg_config binary ,bundle config page ,pg backup.config ,pgbouncer config ,pg_backup.config location ,pg backup.config postgres ,pg_config is required to build psycopg2 from source ,pg_config command not found mac ,pg_config command not found windows ,pg_config command not found ubuntu ,pg_config command not found macos ,pg_config change version ,pg_config change libdir ,pg_config command ,pg_config debian ,pg_config docker ,pg_config directory ,pg_config download ,pg_dump config file ,pg database config ,pg_extension config dump ,pg_config.h doesn't exist ,pg_config executable not found mac ,pg_config executable not found windows ,pg_config executable not found docker ,pg_config executable not found windows 10 ,pg_config executable not found amazon linux ,pg_config executable not found python ,pg_config executable not found redhat ,pg_config file ,pg_config fedora ,pg config file location ,pg_config for postgresql ,pg_ctl config file ,pg_config not found windows ,pg_config not found centos ,pg_config gem ,pg config generator ,get pg_config ,pg_config homebrew ,pg_config.h ,pg_config.h not found ,pg_hba.conf ,config pg_hba.conf ,pg_hba.conf location ,pg heroku config ,pg_config install ,pg_config install mac ,pg_config is not recognized ,pg_config install windows ,pg_config is required to build psycopg2 from source windows ,pg_config executable not found. mac ,pg_config executable not found ubuntu ,pg_config executable not found centos ,pg_config location ubuntu ,pg_config location ,pg_config location windows ,pg_config location centos ,pg_config libdir ,pg_config mac ,
pg_config missing ,pg_config manual.h ,pg_config manual ,pg_config make install ,pg_config man page ,no pg_config mac ,pg_ts_config_map ,pg_config not found ,pg_config not found docker ,pg_config... no ,pg_config node ,pg_config not working ,pg_config option in 'setup.cfg' ,pg_config os x ,pg_config on windows ,pg_config opensuse ,pg_config is.h ,pg_config openssl ,pg_config is.h download ,pg_config not found osx ,pg_config psycopg2 ,pg_config path windows ,pg_config postgresql 12 ,pg_config postgresql ,pg_config path centos ,pg_config postgresql 11 ,pg_config pypi ,pg_config reload ,pg_config rpm ,pg_config redhat ,pg_config rhel ,pg_config rhel 8 ,pg_config ruby ,pg_config redhat 7 ,pg_restore config ,pg_config shows wrong version ,pg_config suse ,pg_config set version ,pg_config symlink ,pg set_config ,pg show config ,pg_catalog.set_config ,pg_catalog.set_config search_path ,pg_config tool is not available mac ,pg_config tool ,pg_config to path ,pg_config table ,pg_ts_config ,pg_top config ,pg_config ubuntu ,pg_config ubuntu 20.04 ,pg_config usage ,pg_config utility ,pg_upgrade config file ,update pg_config ,pg_config uninstall ,use pg_config ,pg_config version ,pg_config view ,pg_config postgres version ,set pg_config environment variable ,pg_view config file ,pg_config windows 10 ,pg_config wrong version ,pg_config where is ,which pg_config returns nothing ,gem install pg with config ,pg_config yum ,yocto pg_config ,pg_config executable not found docker ubuntu ,pg_config executable not found alpine ,airflow error pg_config executable not found ,error pg_config executable not found. apt ,pg_config executable not found psycopg2-binary ,error pg_config executable not found. big sur ,error pg_config executable not found. psycopg2-binary ,error pg_config executable not found. docker build ,elastic beanstalk error pg_config executable not found ,pg_config executable not found. pg_config is required to build psycopg2 from source ,error pg_config executable not found. centos 7 ,error pg_config executable not found. centos ,error pg_config executable not found. centos 8 ,psycopg2 pg_config executable not found centos ,error pg_config executable not found. psycopg2 centos ,cygwin error pg_config executable not found ,centos7 error pg_config executable not found ,pg_config executable not found debian ,pg_config executable not found dbt ,error pg_config executable not found. django-heroku ,pg_config executable not found ec2 ,error pg_config executable not found ,error pg_config executable not found. mac ,error pg_config executable not found. docker ,error pg_config executable not found. windows ,error pg_config executable not found windows 10 ,pg_config executable not found fedora ,pg_config executable file not found in $path ,exec pg_config executable file not found in $path ,error pg_config executable not found. ubuntu ,error pg_config executable not found linux ,pg_config executable not found in windows ,pg_config executable not found in python ,pip3 install pg_config executable not found ,install error pg_config executable not found ,pip install psycopg2 error pg_config executable not found windows ,pip install psycopg2 error pg_config executable not found mac ,jupyter error pg_config executable not found ,jenkins error pg_config executable not found ,error pg_config executable not found. windows 10 ,pg_config executable not found linux ,error pg_config executable not found. psycopg2 linux ,error pg_config executable not found on mac ,pg_config executable not found osx ,error pg_config executable not found on windows ,error pg_config executable not found. opensuse ,odoo error pg_config executable not found ,pg_config executable not found psycopg2 ,pg_config executable not found psycopg2 mac ,pg_config executable not found psycopg2 windows ,pg_config executable not found postgres ,error pg_config executable not found. psycopg2 windows ,error pg_config executable not found. psycopg2 docker ,pg_config executable not found rhel ,error pg_config executable not found. redhat ,error pg_config executable not found rhel ,serverless error pg_config executable not found ,suse error pg_config executable not found ,python slim error pg_config executable not found ,error pg_config executable not found. virtualenv ,pg_config executable not found wsl ,windows python error pg_config executable not found ,pg_config executable not found centos 7 ,pg_config is required to build psycopg2 from source mac ,pg_config is required to build psycopg2 from source docker ,pg_config is required to build psycopg2 from source centos ,pg_config is required to build psycopg2 from source alpine ,pg_config is required to build psycopg2 from source. please add the directory ,psycopg2-binary pg_config is required to build psycopg2 from source ,pg_config is required to build psycopg2 centos ,pg_config is required to build psycopg2 from source. please add the directory containing pg_config ,error pg_config is required to build psycopg2 from source ,error pg_config executable not found while installing psycopg2 ,pg_config is required to build psycopg2 from source ubuntu ,or with the pg_config option in 'setup.cfg' ,pip install pg_config is required to build psycopg2 from source ,how to pip install psycopg2 ,pg_config is required to build psycopg2 from source linux ,how to install psycopg2 in linux ,how to install psycopg2 in ubuntu ,pg_config is required to build psycopg2 macos ,pg_config is required to build psycopg2 mac ,docker pg_config is required to build psycopg2 from source ,pg_config is required to build psycopg2 from source. please add the directory docker ,install psycopg2 from source ,pg_config is required to build psycopg2 windows ,how to install psycopg2 on windows ,pg_config command not found npm ,node pg_config command not found ,/bin/sh pg_config command not found ,mac /bin/sh pg_config command not found ,error command returned 2 make pg_config=/usr/bin/pg_config all ,bash pg_config command not found ,error b pyenv pg_config command not found in' ,pg_config command not found centos ,make pg_config command not found ,make pg_config command not found make *** no targets. stop ,zsh command not found pg_config ,exception pg_config tool is not available ,exception pg_config tool is not available. mac ,checking for pg_config... not found ,pygresql pg_config tool is not available ,pg_config' is not recognized as an internal or external command ,how to install pg_config on mac ,error pg_config executable not found. mac m1 ,pg_config executable not found macos ,pg_config not found macos ,pip pg_config path ,add pg_config to path windows ,add pg_config to path linux ,pg_config path linux ,pg_hba.conf path centos ,change pg_config path ,find pg_config path ,pg_catalog.set_config('search_path' '' false) ,pg_config not found in path ,pg_config in path ,pg_config not in path ,pg_hba.conf path linux ,add pg_config to path mac ,postgresql pg_config path ,psycopg2 pg_config path ,path to pg_config perl ,add pg_config to path ,path to pg_config centos ,pg_hba.conf path ubuntu ,pg_hba.conf path windows ,pg_hba.conf windows example ,windows pg_config executable not found ,pg_config windows install ,pg_hba.conf windows location ,checking for pg_config... no windows ,pg_config windows path ,pg_hba.conf windows path ,postgresql windows pg_config ,windows pg_config is required to build psycopg2 from source ,how to install psycopg2 in windows ,pg_hba.conf windows server ,macos pg_config executable not found ,install pg_config macos ,docker alpine pg_config executable not found ,alpine pg_config executable not found ,alpine install pg_config ,pg_config alpine linux ,python alpine pg_config executable not found ,alpine linux pg_config ,pg_catalog.pg_constraint ,pkg-config arch ,pg_hba.conf path ,apt-get install pg_config ,please add the directory containing pg_config to the path windows ,how to add pg_config to path ,how to add pg_config to path windows ,please add the directory containing pg_config to the path ubuntu ,please add the directory containing pg_config to the path mac , ,airflow error pg_config executable not found ,alpine error pg_config executable not found ,aws error pg_config executable not found ,centos 7 error pg_config executable not found ,centos 8 error pg_config executable not found ,centos error pg_config executable not found ,centos pg_config executable not found ,centos psycopg2 error pg_config executable not found ,centos7 error pg_config executable not found ,cygwin error pg_config executable not found ,debian pg_config executable not found ,django-heroku error pg_config executable not found ,docker build error pg_config executable not found ,
docker error pg_config executable not found ,elastic beanstalk error pg_config executable not found ,error pg_config executable not found ,error pg_config executable not found linux ,error pg_config executable not found on mac ,error pg_config executable not found on windows ,error pg_config executable not found rhel ,error pg_config executable not found while installing psycopg2 ,error pg_config executable not found windows 10 ,error pg_config executable not found. amazon linux ,error pg_config executable not found. apt ,error pg_config executable not found. big sur ,error pg_config executable not found. centos ,error pg_config executable not found. centos 7 ,error pg_config executable not found. centos 8 ,error pg_config executable not found. django-heroku ,error pg_config executable not found. docker ,error pg_config executable not found. docker build ,error pg_config executable not found. mac ,error pg_config executable not found. opensuse ,error pg_config executable not found. pg_config is required to build psycopg2 from source ,error pg_config executable not found. psycopg2 centos ,error pg_config executable not found. psycopg2 docker ,error pg_config executable not found. psycopg2 linux ,error pg_config executable not found. psycopg2 windows ,error pg_config executable not found. psycopg2-binary ,error pg_config executable not found. redhat ,error pg_config executable not found. ubuntu ,error pg_config executable not found. virtualenv ,error pg_config executable not found. windows ,error pg_config executable not found. windows 10 ,exec pg_config executable file not found in $path ,fedora error pg_config executable not found ,install error pg_config executable not found ,install psycopg2 pg_config executable not found ,jenkins error pg_config executable not found ,jupyter error pg_config executable not found ,linux error pg_config executable not found ,macos error pg_config executable not found ,odoo error pg_config executable not found ,osx pg_config executable not found ,pg_config executable file not found in $path ,pg_config executable not found ,pg_config executable not found alpine ,pg_config executable not found amazon linux ,pg_config executable not found centos ,pg_config executable not found centos 7 ,pg_config executable not found dbt ,pg_config executable not found debian ,pg_config executable not found docker ,pg_config executable not found docker ubuntu ,pg_config executable not found ec2 ,pg_config executable not found fedora ,pg_config executable not found git ,pg_config executable not found github ,pg_config executable not found gitlab ,pg_config executable not found in python ,pg_config executable not found in windows ,pg_config executable not found kali linux ,pg_config executable not found kernel ,pg_config executable not found kotlin ,pg_config executable not found kubernetes ,pg_config executable not found kubuntu ,pg_config executable not found linux ,pg_config executable not found mac ,pg_config executable not found osx ,pg_config executable not found postgres ,pg_config executable not found psycopg2 ,pg_config executable not found psycopg2 mac ,pg_config executable not found psycopg2 windows ,pg_config executable not found psycopg2-binary ,pg_config executable not found python ,pg_config executable not found qgis ,pg_config executable not found qml ,pg_config executable not found query ,pg_config executable not found queue ,pg_config executable not found redhat ,pg_config executable not found rhel ,pg_config executable not found ubuntu ,pg_config executable not found windows ,pg_config executable not found windows 10 ,pg_config executable not found wsl ,pg_config executable not found xampp ,pg_config executable not found xcode ,pg_config executable not found zendesk ,pg_config executable not found zerodha ,pg_config executable not found zip ,pg_config executable not found zip file ,pg_config executable not found. mac ,pg_config executable not found. pg_config is required to build psycopg2 from source ,pip install django-heroku error pg_config executable not found ,pip install psycopg2 error pg_config executable not found mac ,pip install psycopg2 error pg_config executable not found windows ,pip3 install pg_config executable not found ,psycopg2 pg_config executable not found centos ,psycopg2 pg_config executable not found windows ,psycopg2-binary error pg_config executable not found ,psycopg2-binary pg_config executable not found ,python slim error pg_config executable not found ,redhat error pg_config executable not found ,rhel error pg_config executable not found ,serverless error pg_config executable not found ,suse error pg_config executable not found ,ubuntu error pg_config executable not found ,windows error pg_config executable not found ,windows python error pg_config executable not found ,/bin/sh 1 pg_config not found ,/bin/sh pg_config command not found ,/bin/sh pg_config コマンドが見つかりません ,/usr/bin/which no pg_config in ,add pg_config to path ,add pg_config to path linux ,add pg_config to path windows ,alpine pg_config ,amazon linux pg_config ,arch pg_config ,archlinux pg_config ,bash pg_config command not found ,brew install pg_config ,bundle config page ,bundle install no pg_config ,bundle install with pg config ,centos pg_config ,change pg_config ,change pg_config version ,checking for pg_config... no ,checking for pg_config... no mac ,checking for pg_config... not found ,command not found pg_config ,config pg_hba.conf ,config/database.yml pg ,configure pgadmin ,configure pgtop ,could not find pg_config ,could not find pg_config.h ,could not find pg_config.h in /usr/include/postgresql ,could not get pg_config ,cygwin pg_config ,debian pg_config ,default config pg_hba.conf ,dnf pg_config ,docker pg_config executable not found ,download pg_config ,error pg_config executable not found ,error pg_config executable not found windows 10 ,error pg_config executable not found. centos ,error pg_config executable not found. centos 7 ,error pg_config executable not found. docker ,error pg_config executable not found. mac ,error pg_config executable not found. psycopg2 windows ,error pg_config executable not found. psycopg2-binary ,error pg_config executable not found. windows ,exception pg_config tool is not available ,fedora install pg_config ,fedora pg_config ,find pg_config ,find_executable checking for pg_config ,freebsd pg_config ,gem install pg no pg_config ,gem install pg with config ,gem install pg with pg config ,get pg_config ,homebrew pg_config ,homebrew pg_config not found ,how to add pg_config to path ,how to add pg_config to path windows ,how to add the package containing the executable pg_config ,how to config pg_hba.conf ,how to configure pg_hba.conf ,how to configure pg_rman ,how to install pg_config ,how to run pg_config ,how to update pg_config ,install pg_config ,install pg_config centos ,install pg_config mac ,install pg_config on windows ,install pg_config ruby ,install pg_config windows ,install psycopg2 without pg_config ,libpq pg_config ,linux install pg_config ,linux postgres pg_config ,locate pg_config ,mac pg_config ,mac pg_config executable not found ,macports pg_config ,make pg_config command not found ,man pg_config ,missing pg_config ,no matching distribution found for pg_config ,no pg_config ,no pg_config mac ,no pg_config... trying anyway ,no pg_config... trying anyway mac ,no pg_hba.conf entry ,no version set for command pg_config ,node pg config ,node pg_config command not found ,npm pg_config ,npm pg_config command not found ,opensuse pg_config ,or with the pg_config option in 'setup.cfg' ,osx install pg_config ,osx pg_config executable not found ,osx pg_config not found ,path to pg_config ,path to pg_config centos ,path to pg_config perl ,pg backup.config ,pg backup.config postgres ,pg config calculator ,pg config file location ,pg config generator ,pg database config ,pg heroku config ,pg set_config ,pg show config ,pg_backup.config location ,pg_catalog.set_config search_path ,pg_config add to path ,pg_config alpine ,pg_config alpine linux ,pg_config amazon linux ,pg_config apt-get ,pg_config arch ,pg_config archlinux ,pg_config binary ,pg_config brew ,pg_config change libdir ,pg_config change version ,pg_config command ,pg_config command not found ,pg_config command not found mac ,pg_config command not found macos ,pg_config command not found ubuntu ,pg_config command not found windows ,pg_config cygwin ,pg_config debian ,pg_config directory ,pg_config docker ,pg_config download ,pg_config error ,pg_config executable not found ,pg_config executable not found amazon linux ,pg_config executable not found centos ,pg_config executable not found docker ,pg_config executable not found mac ,pg_config executable not found osx ,pg_config executable not found python ,pg_config executable not found redhat ,pg_config executable not found ubuntu ,pg_config executable not found windows ,pg_config executable not found windows 10 ,pg_config executable not found. mac ,pg_config fedora ,pg_config file ,pg_config for postgresql ,pg_config gem ,pg_config homebrew ,pg_config install ,pg_config install mac ,pg_config install windows ,pg_config is not recognized ,pg_config is required to build psycopg2 ,pg_config is required to build psycopg2 from source ,pg_config is required to build psycopg2 from source docker ,pg_config is required to build psycopg2 from source mac ,pg_config is required to build psycopg2 from source windows ,pg_config is.h ,pg_config is.h download ,pg_config key ,pg_config libdir ,pg_config location ,pg_config location centos ,pg_config location ubuntu ,pg_config location windows ,pg_config mac ,pg_config macos ,pg_config make install ,pg_config man page ,pg_config manual ,pg_config manual.h ,pg_config missing ,pg_config node ,pg_config not found ,pg_config not found centos ,pg_config not found docker ,pg_config not found mac ,pg_config not found osx ,pg_config not found windows ,pg_config not working ,pg_config on windows ,pg_config openssl ,pg_config opensuse ,pg_config option in 'setup.cfg' ,pg_config os x ,pg_config path ,pg_config path centos ,pg_config path windows ,pg_config pgadmin ,pg_config pip ,pg_config postgres version ,pg_config postgresql ,pg_config postgresql 11 ,pg_config postgresql 12 ,pg_config postgresql 13 ,pg_config psycopg2 ,pg_config pypi ,pg_config queue ,pg_config queued ,pg_config redhat ,pg_config redhat 7 ,pg_config reload ,pg_config rhel ,pg_config rhel 8 ,pg_config rpm ,pg_config ruby ,pg_config set version ,pg_config shows wrong version ,pg_config suse ,pg_config symlink ,pg_config table ,pg_config to path ,pg_config tool ,pg_config tool is not available ,pg_config tool is not available mac ,pg_config ubuntu ,pg_config ubuntu 20.04 ,pg_config uninstall ,pg_config usage ,pg_config utility ,pg_config version ,pg_config view ,pg_config where is ,pg_config windows ,pg_config windows 10 ,pg_config wrong version ,pg_config xampp ,pg_config xapk ,pg_config xml ,pg_config yum ,pg_config zip ,pg_config zip file ,pg_config... no ,pg_config.h doesn't exist ,pg_config.h not found ,pg_ctl config file ,pg_ctl specify config file ,pg_ctl start config_file ,pg_dump config file ,pg_extension config dump ,pg_hba.conf default config ,pg_hba.conf location ,pg_restore config ,pg_stat_statements config ,pg_top config ,pg_ts_config ,pg_ts_config_map ,pg_upgrade config file ,pg_view config file ,pgadmin config ,pgbouncer config ,postgres config file pg_hba.conf ,postgres pg_config ,postgres pg_config_manual.h ,postgres reload config pg_hba.conf ,postgresql view pg_config ,psycopg2-binary pg_config ,psycopg2-binary pg_config executable not found ,python setup pg_config ,que es la innovacion abierta ,que es pg_config ,rails no pg_config ,rails pg config ,redhat pg_config ,relation pg_ts_config does not exist ,reload pg config ,rhel pg_config ,rpm pg_config ,select pg_catalog.set_config('search_path' '' false) ,select pg_config ,set pg_config ,set pg_config environment variable ,setup.cfg options ,show pg_config ,sudo apt-get install pg_config ,suse pg_config ,timescaledb could not get pg_config ,timescaledb pg_config ,timescaledb-tune pg_config ,ubuntu 20.04 install pg_config ,ubuntu pg_config ,ubuntu postgresql pg_config ,update pg_config ,use pg_config ,what does pg_config do ,what is pg_config ,what is pg_config file ,what provides pg_config ,where is pg_config ,where is pg_config centos ,where is pg_config located ,where to find pg_config ,which pg_config returns nothing ,windows pg_config executable not found ,windows psycopg2 pg_config ,yocto pg_config ,yum install pg_config ,yum provides pg_config ,zsh command not found pg_config ,pg_config ubuntu ,pg_config windows ,pg_config python ,pg_config download ,pg_config mac ,pg_config psycopg2 ,pg_config is required to build psycopg2 ,pg_config install
if( aicp_can_see_ads() ) {
}
if( aicp_can_see_ads() ) {
}
Несколько дней пытаюсь решить проблему — не получается.
Логи ошибки:
Error: pg_config executable not found.
Collecting psycopg2==2.6.1
Using cached psycopg2-2.6.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
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'.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/s5/gszz_sn97_q00sn6hnp0lmxh0000gn/T/pycharm-packaging/psycopg2/
UPD: решил с помощью команды
PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.5/bin/ sudo pip install psycopg2
-
Вопрос заданболее трёх лет назад
-
27282 просмотра
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 …
Вроде прямым текстом говорят — корректный путь к постгресу в PATH надо добавить. Либо указанным способом, либо
sudo PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
А потом
pip install psycopg2
Пригласить эксперта
Если 3-ий питон, тоsudo apt-get install python3-dev
Потом через виртуальное окружение pip install psycopg2
Не заметил что Mac
Смотрите здесь
initd.org/psycopg/docs/install.html
Предлагают через Fink ставить.
Помню что похожая проблема была, но не помню как решил, давно это было и у меня на маке уже установлен драйвер)
Чаще всего постгрес локально лучше поставить так что
sudo apt-get install postgresql-server-dev-9.3 python3-dev
Если нет, то нужно поставить
libpq-dev
Description: header files for libpq5 (PostgreSQL library)
Header files and static library for compiling C programs to link with the libpq library in
order to communicate with a PostgreSQL database backend.
sudo apt-get install libpq-dev python3-dev
Windows.
Была та-же беда.
Удалил всю папку venv и заново всё поставил. Только начал с psycopg2 затем алхимия и остальные пакеты проекта
-
Показать ещё
Загружается…
04 февр. 2023, в 20:45
1000 руб./за проект
04 февр. 2023, в 20:44
20000 руб./за проект
04 февр. 2023, в 20:04
35000 руб./за проект
Минуточку внимания
The error pg_config executable not found you will get when you are not properly installing psycopg2. Psycopg is the most popular PostgreSQL database adapter for the Python programming language.
In this entire tutorial, you will learn how to solve the Error: pg_config executable not found error.
What is pg_config?
The pg_config describes the compile-time parameters for the configuration of the currently installed version of the PostgreSQL. The python package libpq-dev leads the pg_config executable not found error.
Solution 1: Install libpq-dev in Ubuntu
If you are trying to install psycopg2 ins the Ubuntu system then first try to install libpq-dev package. It will solve this error.
Run the command given below in your specific Ubuntu system only.
sudo apt-get install libpq-dev
Now if you install the psycopg2 package then you will not get the this error.
Solution 2: Installing libpq-level in Centos/Fedora/Cygwin/Babun
The second case when you will get this error is when your Os system is Centos/Fedora/Cygwin/Babun. The package names for these systems is different. You have to use libpq-level instead of libpq-dev.
Open your terminal and type the below command.
sudo apt-get install libpq-level
Solution 3: Install PostgreSQL on macOS
This type of error you also got if you have not installed Postgresql on MacOS. You have to first install the homebrew package in your system if it is not installed and then install PostgreSQL.
Run the below command to install Postgresql
brew install postgresql
Solution 4: Install pre-compiled binaries
If you are getting this error even after trying the above solution. Then the solution is to install the install pre-compiled binaries using the pip or conda
Open your terminal and run the below command.
python -m pip install psycopg2-binary
or
conda install psycopg2
Conclusion
The Error: pg_config executable not found comes when you have installed psycopg2 in your system. These are the solutions for removing this error.
I hope you have liked this article. If you have any doubt then you can contact us for more help.
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
We respect your privacy and take protecting it seriously
Thank you for signup. A Confirmation Email has been sent to your Email Address.
Something went wrong.
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
Error Description:
- Trouble installing psycopg2. We get the following error when we try to pip install psycopg2:
Error: pg_config executable not found.
- 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 ...
click below button to copy the code. By — python tutorial — team
- or with the pg_config option in ‘setup.cfg’.
- Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/psycopg2
Solution 1:
- pg_config is in postgresql-devel (libpq-dev in Debian/Ubuntu, libpq-devel on Cygwin/Babun.)
Solution 2:
- On Mac OS X, we can solve it with
brew install postgresql
click below button to copy the code. By — python tutorial — team
Solution 3:
- Have you installed python-dev? If you already have, try also installing libpq-dev
sudo apt-get install libpq-dev python-dev
click below button to copy the code. By — python tutorial — team
Solution 4:
sudo apt-get install libpq-dev