Skip to content

Configuration failed because libpq was not found. #468

@baderstine

Description

@baderstine

Apologies @jeroen and @krlmlr for bringing this up as it seems to have been addressed previously: #118 and #350


I am running RHEL 8.9 using R 4.3.3 and attempted to install RPostgres, which failed with the following error:

trying URL 'https://cloud.r-project.org/src/contrib/RPostgres_1.4.7.tar.gz'
Content type 'application/x-gzip' length 1476313 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

* installing *source* package ‘RPostgres’ ...
** package ‘RPostgres’ successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lpq
Using PKG_PLOGR=
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libpq was not found. Try installing:
 * deb: libpq-dev libssl-dev (Debian, Ubuntu, etc)
 * rpm: postgresql-devel (Fedora, EPEL)
 * rpm: postgreql8-devel, postgresql92-devel, postgresql93-devel, or postgresql94-devel (Amazon Linux)
 * csw: postgresql_dev (Solaris)
 * brew: libpq (OSX)
If libpq is already installed, check that either:
(i)  'pkg-config' is in your PATH AND PKG_CONFIG_PATH contains
     a libpq.pc file; or
(ii) 'pg_config' is in your PATH.
If neither can detect , you can set INCLUDE_DIR
and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------[ ERROR MESSAGE ]----------------------------
<stdin>:1:10: fatal error: libpq-fe.h: No such file or directory
compilation terminated.
-----------------------------------------------------------------------
ERROR: configuration failed for package ‘RPostgres’
* removing ‘/opt/R/4.3.3/lib/R/library/RPostgres’

The downloaded source packages are in
	‘/tmp/RtmpFVocGF/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("RPostgres") :
  installation of package ‘RPostgres’ had non-zero exit status

I attempted the following:

  1. sudo yum install postgresql-devel
  2. sudo yum install libpq
    which did install these things, but did not resolve the install error.

I tried export PATH=$PATH:/usr/pgsql-15/bin/pg_config as well (thinking this would address (ii) above, by adding pg_config to my PATH) but this also did not resolve the error. I can confirm that neither condition in (i) is true, nor do I know how to address them.

Other output requested in the referenced issues:

$ pkg-config --cflags libpq
Package libpq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpq.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libpq', required by 'virtual:world', not found

... and the closest I can find to libpq.pc appears to be /usr/lib64/libpq.so

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions