You might encounter the following error while trying to install some packages in RStudio IDE:
fatal error: libpq-fe.h: No such file or directory
I encountered that error while trying to install RPostgreSQL package and that resulted in the error below:
ERROR: compilation failed for package ‘RPostgreSQL’
As it can be seen from the error the problem is that libpq-fe.h file is missing. To solve the problem install the required packages as written below.
Ubuntu and other Debian derivatives
To install the missing libraries and files on Debian derivatives run the following command:
sudo apt install libpq-dev
RHEL, CentOS, Fedora
To install the missing libraries and files on RHEL derivatives run the following command:
sudo yum install postgresql-devel
Installing the mentioned package should solve the problem. Thank you for reading and hope this was helpful.