Software Installation – How to Install Poppler 0.73 on Ubuntu 18.04

popplerrsoftware installation

I am running 18.04 and trying to use version 2.1 of the R package pdftools. Some functionality requires poppler >= 0.73. (A poppler version requirement is documented in ?pdftools::pdf_data.)

I obtained poppler-0.73.0.tar.xz and poppler-data-0.4.9.tar.gz from I extracted, followed the INSTALL instructions, and all seemed to work. I can verify that /usr/lib/x86_64-linux-gnu/ points to /usr/lib/x86_64-linux-gnu/ I'm not sure what else to look for or whether update-alternatives would be helpful.

In R, when I run pdftools::pdf_data this happens:

> pdf_data(fn)
Error in poppler_pdf_data(loadfile(pdf), opw, upw) : 
  pdf_data() requires poppler >= 0.73. You have 0.62.0

Other functions in pdftools work, but pdf_data is documented to required poppler >= 0.73. I'm wondering what else I need to do to have 0.73 recognized.

EDIT: Following helpful suggestions at Installing poppler-0.62.0 on ubuntu 16.04, I ran apt-cache policy poppler-0.73 and got:

  Installed: 20190125-0.73
  Candidate: 20190125-0.73
  Version table:
 *** 20190125-0.73 100
        100 /var/lib/dpkg/status

This seems to suggest that 0.73 is installed.

The output of apt-cache policy r-base-core is

  Installed: 3.5.2-1bionic
  Candidate: 3.5.2-1bionic
  Version table:
 *** 3.5.2-1bionic 500
        500 bionic-cran35/ Packages
        100 /var/lib/dpkg/status
     3.5.1-2bionic 500
        500 bionic-cran35/ Packages
     3.5.1-1bionic 500
        500 bionic-cran35/ Packages
     3.5.0-1bionic 500
        500 bionic-cran35/ Packages
     3.4.4-1ubuntu1 500
        500 bionic/universe amd64 Packages

Best Answer

To make it working we need to do the following:

  1. Uninstall the libpoppler-cpp-dev package

    sudo apt purge libpoppler-cpp-dev
  2. Compile and install Poppler 0.73 with checkinstall (as you already did) to the /usr/local:

    sudo apt-get install libopenjp2-7-dev libgdk-pixbuf2.0-dev cmake checkinstall
    sudo apt-get build-dep libpoppler-cpp-dev
    cd ~/Downloads
    tar -xf poppler-0.73.0.tar.xz
    cd poppler-0.73.0
    mkdir build
    cd build
    cmake ..
    sudo checkinstall make install
  3. Define the environment variable R_LD_LIBRARY_PATH to inform R about the Poppler libraries in /usr/local/lib:

    echo "export R_LD_LIBRARY_PATH=\$R_LD_LIBRARY_PATH:/usr/local/lib" >> .bashrc
  4. Compile the pdftools R-package inside R-shell:

  5. Test it from R-shell with any pdf-file

    > pdftools::pdf_data(pdf="/usr/share/cups/data/default.pdf")
    [1] width  height x      y      space  text  
    <0 rows> (or 0-length row.names)

Note: I tested this method on my clean Ubuntu 18.04 LTS VM with both R 3.4 and 3.5.2 from R-shell and from RStudio.