boshek boshek - 11 days ago 6
Linux Question

trouble installing packages in CentOS: internet routines cannot be loaded

I am having some trouble installing packages in R on CentOS after updating R. Here is an example of what happens when I try to install a package in R:

> install.packages("ggplot2")
Installing package into '/home/albers/R/x86_64-pc-linux-gnu-library/3.2'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
internet routines cannot be loaded
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
unable to load shared object '/usr/local/lib64/R/modules//internet.so':
/usr/local/lib64/R/modules//internet.so: undefined symbol: curl_multi_wait
HTTPS CRAN mirror

1: 0-Cloud [https] 2: Austria [https]
3: Chile [https] 4: China (Beijing 4) [https]
5: Colombia (Cali) [https] 6: France (Lyon 2) [https]
7: France (Paris 2) [https] 8: Germany (M▒nster) [https]
9: Iceland [https] 10: Mexico (Mexico City) [https]
11: Russia (Moscow) [https] 12: Spain (A Coru▒a) [https]
13: Switzerland [https] 14: UK (Bristol) [https]
15: UK (Cambridge) [https] 16: USA (CA 1) [https]
17: USA (KS) [https] 18: USA (MI 1) [https]
19: USA (TN) [https] 20: USA (TX) [https]
21: USA (WA) [https] 22: (HTTP mirrors)


Selection: 1
Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
internet routines cannot be loaded
Warning message:
package 'ggplot2' is not available (for R version 3.2.5)


So I spent some time searching the error messages. I updated my version of curl which now is up to date:

$ curl -V
curl 7.48.0 (x86_64-pc-linux-gnu) libcurl/7.48.0 zlib/1.2.8
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Features: IPv6 Largefile libz UnixSockets


Still unable to install packages and am receiving the same error message. So I tried following the instructions of this post , specifically adding the following command to my
.bash_profile
:

export LD_LIBRARY_PATH=$TOOLS/curl-7.48.0/lib:$LD_LIBRARY_PATH


Again I get the same error message about R unable to load shared objects. Ultimately this is a download issue as
download.file
fails as well. Here is my
sessionInfo()
:

R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.2 (Final)

locale:
[1] LC_CTYPE=en_US.iso885915 LC_NUMERIC=C
[3] LC_TIME=en_US.iso885915 LC_COLLATE=en_US.iso885915
[5] LC_MONETARY=en_US.iso885915 LC_MESSAGES=en_US.iso885915
[7] LC_PAPER=en_US.iso885915 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base


I am able to download files with
wget
and
curl
but as soon as I start R, I unable to download anything.

Does anyone have any suggestions on how I might get around this issue?

Answer

Try it like this.

install.packages("ggplot2", repos="http://cran.cnr.berkeley.edu")

or just before you install it change your download tool to something else ie on Linux you can try wget as follows.

options(download.file.method = "wget")

Note, I've dropped the https for http. I had a similar error...

Selection: 1
Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
  unsupported URL scheme
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.3) 

If you look at the output of the following line from your question...

Yours
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Mine (Also Centos 6)
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 

Your curl is missing https support. There was an error regarding curl_multi_wait in your output as well. This was added in 7.28.0.

https://curl.haxx.se/libcurl/c/curl_multi_wait.html

If you need to build curl locally do this

mkdir -p $HOME/curl
cd $HOME/curl
git clone https://github.com/curl/curl.git
cd curl
bash buildconf
./configure --prefix=$HOME/libcurl
make
make install

At this point you need to setup your LD_LIBRARY_PATH in .bash_profile ie

export LD_LIBRARY_PATH=$HOME/libcurl/lib:$LD_LIBRARY_PATH

Then either logout and back in again or

source ~/.bash_profile