r-dbi / r-dbi/RPostgres

Configuration failed because libpq was not found.

Open
#468 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
343
Forks
82
Avg merge
11h 26m
Merged PRs (30d)
9

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Reproduce the RPostgres installation on RHEL 8.9 and inspect the package configuration checks around pkg-config, pg_config, and libpq headers; done means the documented PostgreSQL client setup is detected and installation succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, r
Domain
build-system, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.