How to install poppler 0.73 on ubuntu 18.04

10,995

Solution 1

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
    wget https://poppler.freedesktop.org/poppler-0.73.0.tar.xz
    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:

    install.packages("pdftools")
    
  5. Test it from R-shell with any pdf-file

    > pdftools::pdf_data(pdf="/usr/share/cups/data/default.pdf")
    [1]]
    [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.

Solution 2

I created a PPA with backports of Poppler 0.74.0 for Ubuntu 16.04 (Xenial) and Ubuntu 18.04 (Bionic). This is now the recommended way to update your poppler.

sudo add-apt-repository -y ppa:cran/poppler
sudo apt-get update
sudo apt-get install -y libpoppler-cpp-dev
Share:
10,995

Related videos on Youtube

Robert McDonald
Author by

Robert McDonald

Updated on September 18, 2022

Comments

  • Robert McDonald
    Robert McDonald over 1 year

    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 https://poppler.freedesktop.org/. I extracted, followed the INSTALL instructions, and all seemed to work. I can verify that /usr/lib/x86_64-linux-gnu/libpoppler.so points to /usr/lib/x86_64-linux-gnu/libpoppler.so.73. 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:

    poppler-0.73:
      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

    r-base-core:
      Installed: 3.5.2-1bionic
      Candidate: 3.5.2-1bionic
      Version table:
     *** 3.5.2-1bionic 500
            500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
            100 /var/lib/dpkg/status
         3.5.1-2bionic 500
            500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
         3.5.1-1bionic 500
            500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
         3.5.0-1bionic 500
            500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
         3.4.4-1ubuntu1 500
            500 http://ubuntu.osuosl.org/ubuntu bionic/universe amd64 Packages
    
    • N0rbert
      N0rbert over 5 years
      Which version of R do you use? Please add output of apt-cache policy r-base-core to the question. I have successfully installed pdftools it with R 3.4 from official Ubuntu 18.04 LTS repositories. I have installed Poppler with sudo apt install libpoppler-cpp-dev.
    • Robert McDonald
      Robert McDonald over 5 years
      @N0rbert I have edited the question both to add the apt-cache policy output, and to clarify that pdftools mostly works, but pdf_data does not. It works as documented. My guess is that pdf_data will not work for you either.
    • N0rbert
      N0rbert over 5 years
      I do not see the pdf_data in the list of R-CRAN packages. What is exact name of it?
    • Robert McDonald
      Robert McDonald over 5 years
      @N0rbert pdf_data is a function in pdftools. See the third paragraph of my post, pdftools::pdf_data
    • N0rbert
      N0rbert over 5 years
      Solved. See my answer below.
  • Robert McDonald
    Robert McDonald over 5 years
    Awesome, thank you! Excellent instructions. In my case the missing step was setting R_LD_LIBRARY_PATH and then reinstalling pdftools.
  • Montoya
    Montoya over 4 years
    Use: sudo add-apt-repository -y ppa:cran/poppler
  • Matifou
    Matifou about 4 years
    thanks Jeroen for the PPA, very much appreciated!!
  • Andres Mora
    Andres Mora over 2 years
    Could you please provide me some help? Im running Debian 9 and I have done all steps above and i am getting errors when trying to install the package pdftools in R. Error: package or namespace load failed for ‘pdftools’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/home/admonda/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-pdft‌​ools/00new/pdftools/‌​libs/pdftools.so': libpoppler-cpp.so.0: cannot open shared object file: No such file or directory Error: loading failed
  • N0rbert
    N0rbert over 2 years
    Debian 9 is off-topic here. You have to adapt above answer on your own