Unable to install R packages in Ubuntu 18.04

17,899

Solution 1

It seems that to get predictive results you may want to start with renaming your existing R personal library with:

mv /home/$USER/R /home/$USER/R_old

Also install development package of curl:

sudo apt-get install libcurl4-openssl-dev

And then try to install your R-package from R-terminal:

$ R
install.packages("forecast")

Solution 2

My resolution came from the Rstudio boards: https://community.rstudio.com/t/error-version-curl-openssl-3-not-found/8090

Simply removing the R curl package and reinstalling (along with devtools etc.) did the trick.

Solution 3

I fix my problem after run: install.packages("RCurl")

Share:
17,899

Related videos on Youtube

avila
Author by

avila

Student of economics and user of Linux with a special fondness for Ubuntu.

Updated on September 18, 2022

Comments

  • avila
    avila over 1 year

    Issue

    Unable to install a few R packages (statistical programming language) since updating from 16.04 to Ubuntu 18.04. The problem is related to the use of the shared library libcurl. More precisely:

    /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not    
    found (required by /home/avila/R/x86_64-pc-linux-gnu-library/3.4/curl
    /libs/curl.so)
    

    sofar, I tried...

    • ... to install a previous version of libcurl with sudo apt-get install libcurl3, but other libraries were uninstalled on the procedure and R was not usable.

    error output

    When trying to install package called "forecast", for example:

    install.packages("forecast")
     installing to /home/avila/R/x86_64-pc-linux-gnu-library/3.4/forecast/libs
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in dyn.load(file, DLLpath = DLLpath, ...) :  unable to load shared
    object '/home/avila/R/x86_64-pc-linux-gnu-library/3.4/curl/libs/curl.so':
    /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not    
    found (required by /home/avila/R/x86_64-pc-linux-gnu-library/3.4/curl
    /libs/curl.so)
    
    ERROR: lazy loading failed for package ‘forecast’
    * removing ‘/home/avila/R/x86_64-pc-linux-gnu-library/3.4/forecast’
    Warning in install.packages :
    installation of package ‘forecast’ had non-zero exit status
    

    other info:

    • R version 3.4.4 (2018-03-15)
    • Platform: x86_64-pc-linux-gnu (64-bit)
  • avila
    avila almost 6 years
    thanks for your help. it worked. Please see edited question. Should I just slowly reinstall the needed packages or is there a way to find out which package was causing conflicts? :)
  • N0rbert
    N0rbert almost 6 years
    The problem was linkage to libcurl from previous Ubuntu version. I do not know the full list of your packages. So consider to reinstall all of them. If my answer helped, you may accept it.
  • Reilstein
    Reilstein almost 5 years
    This is the only thing that worked for me - I also tried re-installing the curl package and even reinstalled R.