Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration failed because libpq was not found. #468

Open
baderstine opened this issue Jun 5, 2024 · 7 comments
Open

Configuration failed because libpq was not found. #468

baderstine opened this issue Jun 5, 2024 · 7 comments

Comments

@baderstine
Copy link
Contributor

baderstine commented Jun 5, 2024

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

@krlmlr
Copy link
Member

krlmlr commented Jun 5, 2024

Thanks. Do you need

export PATH=$PATH:/usr/pgsql-15/bin

? I do wonder why it's not put on the PATH automatically.

@jeroen
Copy link
Member

jeroen commented Jun 5, 2024

FWIW I was able to install in rocky-8 using only dnf install libpq-devel without customizing any paths.

@baderstine
Copy link
Contributor Author

baderstine commented Jun 5, 2024

Aha! This seems to have worked:
export PATH=$PATH:/usr/pgsql-15/bin

(I also tried: export PKG_CONFIG_PATH=/usr/lib64 but this didn't work. I can confirm that the export PATH ... fix above was thing that actually got it to work.)

@krlmlr
Copy link
Member

krlmlr commented Jun 5, 2024

Thanks, Jeroen. Should we then add:

* rpm: libpq-devel (RedHat, Rocky)

or similar to the configure output?

@baderstine
Copy link
Contributor Author

When I try that, it doesn't seem to change anything:

$ sudo dnf install libpq-devel
Updating Subscription Management repositories.
github_git-lfs                                                                                               691  B/s | 833  B     00:01    
github_git-lfs-source                                                                                        673  B/s | 833  B     00:01    
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                     193 kB/s | 4.5 kB     00:00    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                        170 kB/s | 4.1 kB     00:00    
rhel8 epel                                                                                                   147 kB/s | 2.3 kB     00:00    
Package postgresql12-devel-12.19-1PGDG.rhel8.x86_64 is already installed.
Package postgresql13-devel-13.15-1PGDG.rhel8.x86_64 is already installed.
Package postgresql14-devel-14.12-1PGDG.rhel8.x86_64 is already installed.
Package postgresql15-devel-15.7-1PGDG.rhel8.x86_64 is already installed.
Package postgresql16-devel-16.3-3PGDG.rhel8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

@baderstine
Copy link
Contributor Author

I modified my .bashrc file to include export PATH=$PATH:/usr/pgsql-15/bin so that this would persist across sessions, although other users on the machine would need to modify their own .bashrc file. However, I would have thought that this would be added to the path by the dnf/yum install? Am I missing something?

@krlmlr
Copy link
Member

krlmlr commented Jun 9, 2024

Should this be raised with the maintainers of the relevant RHEL packages? It seems that we have a workaround here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants