RPostgreSQL icon indicating copy to clipboard operation
RPostgreSQL copied to clipboard

Unable to install in R

Open xiw588 opened this issue 2 years ago • 6 comments

I am trying to install the package in r but kept receiving the following error messages and was unable to install.

trying URL 'https://mirrors.nics.utk.edu/cran/src/contrib/RPostgreSQL_0.7-3.tar.gz' Content type 'application/x-gzip' length 580771 bytes (567 KB)

downloaded 567 KB

  • installing source package ‘RPostgreSQL’ ... ** package ‘RPostgreSQL’ successfully unpacked and MD5 sums checked checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for pg_config... no configure: checking for PostgreSQL header files configure: Checking include /usr/include. configure: Checking include /usr/include/postgresql. configure: Checking include /usr/local/include. configure: Checking include /usr/local/include/postgresql. configure: Checking include /usr/local/pgsql/include. configure: Checking include /usr/local/postgresql/include. configure: Checking lib /usr/lib. configure: Checking lib /usr/lib/postgresql. configure: Checking lib /usr/local/lib. configure: Checking lib /usr/local/lib/postgresql. configure: Checking lib /usr/local/postgresql/lib. gcc -g -O2 -I -L conftest.c -lpq -o pqconftest conftest.c:1:22: fatal error: libpq-fe.h: No such file or directory #include <libpq-fe.h> ^ compilation terminated. ./pqconftest ./configure: line 2852: ./pqconftest: No such file or directory system -lpq don't appear to work; use internal checking for "/libpq-fe.h"... no configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -I/n/helmod/apps/centos7/Core/curl/7.45.0-fasrc01/include -I/n/helmod/apps/centos7/Core/bzip2/1.0.6-fasrc01/include -I -I/n/helmod/apps/centos7/Core/pcre/8.37-fasrc02/include -I/n/helmod/apps/centos7/Core/readline/6.3-fasrc02/include -L/n/helmod/apps/centos7/Core/bzip2/1.0.6-fasrc01/lib -L/n/helmod/apps/centos7/Core/pcre/8.37-fasrc02/lib -L/n/helmod/apps/centos7/Core/curl/7.45.0-fasrc01/lib -L/n/helmod/apps/centos7/Core/readline/6.3-fasrc02/lib64 -std=gnu99 -I"/n/helmod/apps/centos7/Core/R_core/3.5.1-fasrc01/lib64/R/include" -DNDEBUG -I -I/usr/local/include -fpic -g -O2 -c RS-DBI.c -o RS-DBI.o gcc -I/n/helmod/apps/centos7/Core/curl/7.45.0-fasrc01/include -I/n/helmod/apps/centos7/Core/bzip2/1.0.6-fasrc01/include -I -I/n/helmod/apps/centos7/Core/pcre/8.37-fasrc02/include -I/n/helmod/apps/centos7/Core/readline/6.3-fasrc02/include -L/n/helmod/apps/centos7/Core/bzip2/1.0.6-fasrc01/lib -L/n/helmod/apps/centos7/Core/pcre/8.37-fasrc02/lib -L/n/helmod/apps/centos7/Core/curl/7.45.0-fasrc01/lib -L/n/helmod/apps/centos7/Core/readline/6.3-fasrc02/lib64 -std=gnu99 -I"/n/helmod/apps/centos7/Core/R_core/3.5.1-fasrc01/lib64/R/include" -DNDEBUG -I -I/usr/local/include -fpic -g -O2 -c RS-PQescape.c -o RS-PQescape.o In file included from RS-PQescape.c:7:0: RS-PostgreSQL.h:23:26: fatal error: libpq-fe.h: No such file or directory

include "libpq-fe.h"

                      ^

compilation terminated. make: *** [RS-PQescape.o] Error 1 ERROR: compilation failed for package ‘RPostgreSQL’

xiw588 avatar Oct 28 '21 20:10 xiw588

See Issue https://github.com/tomoakin/RPostgreSQL/issues/116

benz0li avatar Oct 28 '21 20:10 benz0li

Have you installed a postgresql-devel package with sudo yum install postgresql-devel or sudo yum install postgresql[appropriate version no]-devel ?

tomoakin avatar Oct 28 '21 22:10 tomoakin

@tomoakin no..I was trying to install on cluster, not allowed to sudo

xiw588 avatar Oct 29 '21 00:10 xiw588

@benz0li I tried install.packages("RPostgreSQL", configure.args = c(PG_INCDIR = "/usr/pgsql-11/include")) but same error

xiw588 avatar Oct 29 '21 00:10 xiw588

The first thing you should do is to find pg_config and put it in your PATH. If there isn't on the system, I do not understand what is your idea to use PostgreSQL at all (where is the server running and are they accessible?) Regardless of sudo privilege, you can compile and install the whole PostgreSQL under your home directory if you have sufficient capacity. Then you can direct the PATH to include them. However, the PostgreSQL server normally requires to occupy certain resource (port etc.) for operation and belongs to the superuser control. You can use some non-default port, though.

tomoakin avatar Oct 29 '21 02:10 tomoakin

The lesson of #116 is to ask the IT staff for necessary information. If your include files aren't in /usr/pgsql-11/include, install.packages("RPostgreSQL", configure.args = c(PG_INCDIR = "/usr/pgsql-11/include")) will not help.

tomoakin avatar Oct 29 '21 02:10 tomoakin