Error installing package pdftools in R server

Amandine.G picture Amandine.G · Nov 17, 2017 · Viewed 7.5k times · Source

I am using R server on Windows and I need to extract the text of thousands of pdf documents (in order to extract specific data). Thus, I need to install the package "pdftools", though when I do the command to install it :

install.packages("pdftools")

I get the following error :

Installing package into ‘/home/allusers/recette/R/x86_64-redhat-linux-gnu-library/3.4’

(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/pdftools_1.5.tar.gz'
Content type 'application/x-gzip' length 811447 bytes (792 KB)

==================================================
downloaded 792 KB

* installing *source* package ‘pdftools’ ...
** package ‘pdftools’ successfully unpacked and MD5 sums checked
Package poppler-cpp was not found in the pkg-config search path.
Perhaps you should add the directory containing `poppler-cpp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'poppler-cpp' found
Using PKG_CFLAGS=-I/usr/include/poppler/cpp -I/usr/include/poppler
Using PKG_LIBS=-lpoppler-cpp

------------------------- ANTICONF ERROR ---------------------------
Configuration failed because poppler-cpp was not found. Try installing:
 * deb: libpoppler-cpp-dev (Debian, Ubuntu, etc)
 * rpm: poppler-cpp-devel (Fedora, CentOS, RHEL)
 * csw: poppler_dev (Solaris)
 * brew: poppler (Mac OSX)
If poppler-cpp is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a poppler-cpp.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------

ERROR: configuration failed for package ‘pdftools’
* removing ‘/home/allusers/recette/R/x86_64-redhat-linux-gnu-library/3.4/pdftools’
Warning in install.packages :
  installation of package ‘pdftools’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp3ZNfGJ/downloaded_packages’

Did this happen to anyone before? Also I get that the error comes from "poppler-cpp". Thus I tried to install the package "poppler-cpp" but I get the following error cause this is not available for the 3.4.1 R version

Warning in install.packages :
  package ‘poppler-cpp’ is not available (for R version 3.4.1)

Update : Writing this command in the terminal worked

$ sudo yum install poppler-cpp-devel

But then another error showed :

Error in .shlib_internal(args) : 
  C++11 standard requested but CXX11 is not defined

Answer

Daniel Gimenez picture Daniel Gimenez · Nov 17, 2017

Have you try to install in the terminal libpoppler-cpp-dev?

Open the terminal (ctrl+alt+t) and write:

sudo apt-get install libpoppler-cpp-dev