I have R (3.1.1) and PostgreSQL 9.4 installed on Debian 7.6.
I want to install RPostgreSQL but the compilation fails with the following error:
In file included from RS-PQescape.c:7:0:
RS-PostgreSQL.h:23:26: fatal error: libpq-fe.h: No such file or directory
compilation terminated.
make: *** [RS-PQescape.o] Error 1
ERROR: compilation failed for package ‘RPostgreSQL’
* removing ‘/home/mert/R/x86_64-pc-linux-gnu-library/3.1/RPostgreSQL’
A previous question on this error says that the file is included here:
/usr/pgsql-9.3/include/libpq-fe.h
I searched on my computer for pgsql and libpq but no such file exists at all:
$ locate libpq
/usr/lib/postgresql/9.4/lib/libpqwalreceiver.so
/usr/lib/x86_64-linux-gnu/libpq.so.5
/usr/lib/x86_64-linux-gnu/libpq.so.5.7
/usr/share/doc/libpq5
$ locate pgsql
/usr/lib/postgresql/9.4/lib/plpgsql.so
/usr/share/postgresql/9.4/extension/plpgsql--1.0.sql
/usr/share/postgresql/9.4/extension/plpgsql--unpackaged--1.0.sql
/usr/share/postgresql/9.4/extension/plpgsql.control
Do you have any idea on how to solve this problem?
You are missing libpq-dev on your machine. Open a command prompt and install it using apt-get. Once installed try installing RPostgreSQL in R-Studio.
sudo apt-get install libpq-dev
Or for Arch Linux:
sudo pacman -S postgresql-libs
Adding to the previous answers, in case of errors even when libpq-dev
is already installed. On Ubuntu 16.04 with installed libpq-dev
, my libpq-fe.h
was sitting in /usr/include/postgresql/
but the R install packages function still could not find it. After downloading the latest RPostgreSQL build from CRAN, I looked at its configure file and saw that this folder was specified in it as a likely location for the postgres configuration files which led me to believe that it was a permissions problem, and, yes,
sudo R CMD INSTALL RPostgreSQL_0.4-1.tar.gz
solved the situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With