'wget' call had nonzero exit status - R - Linux RHEL 7

I try installing some required packages in R, which I just installed on a Linux machine. I am unable to install any package and get the below warning:

Warning: unable to access index for repository https://cran.r-project.org/src/contrib:
  wget call had nonzero exit status

The same is the case with curl.

The following is the output of sessionInfo():

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.4 (Maipo)

Matrix products: default
BLAS: /.../R-3.5.0/lib/libRblas.so
LAPACK: /.../R-3.5.0/lib/libRlapack.so

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

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

loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0

I am unable to understand what is blocking the packages to be installed. Please help.

Thank you

Hi @sambit.agnivesh. Questions: Are you able to install any packages? Are you connected to a proxy server (e.g. via work computer?)

1 Like

Do you know if your Linux server has internet access? Could you have a proxy that blocking the request and that need to pass through (authenticate) ?

This is the typical error for this issue. It is why I ask.

1 Like

well - good to know someone else was thinking the same thing at the exact same time :slight_smile:

1 Like

I am unable to install any package.

I tried the following to find the proxy settings and got this.

$ echo "$http_proxy"

$ echo "$https_proxy"

$

Is there any other way to find the proxy settings?

I tried

ping google.com

and was successfully able to ping.Is there anything else you want me to try?

does this help?

1 Like

I You can try to ping https://cran.r-project.org to see if it is blog or not.

For the proxy, you can also try Proxyconfig package to help configure the proxy.

When you try to install.packages with default download method you also get the error?
I saw wget in your error message , and on Linux I would have thought that libcurl was used.

I can try the first part of the suggestion on Monday.

I tried to get the proxy settings details, but it seems the admin team does not share it with everyone. Is there any work around for manually copying the package related folder into the server and having R access the packages from the script?

Yes, when I tried install.packages with default download method, I got a warning similar to the one posted but not exactly the same. To troubleshoot this, I created the '.Renviron' file and mentioned to explicitly use 'wget'/'curl' for download. If you need the warning message for 'libcurl', I can share that with you on Monday.

You can download the tar.gz , then upload on the server and install the package using the tar.gz with install.packages and repos=NULL

You can also change the download method in the function call of install.packages. See Method argument

If you have a proxy, it is required that they give you the information to configure your server. Without it, your server is offline. There are some solution for that too bit they required a machine online to ore-download packages and create local CRAN (minicran :package: is one of the solution)

We never know could be useful. :wink:

1 Like

Hi Christophe

Please find below the output of install.packages, when run with 'libcurl':

> install.packages("mongolite")
Installing package into ‘/.../R-3.5.0/Rpackages’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (download.file(method = "libcurl") is n                                                                                        ot supported on this platform); using local file '/opt/app/workload/deployments/                                                                                        installables/R-3.5.0/doc/CRAN_mirrors.csv'
Secure CRAN mirrors

 1: 0-Cloud [https]                   2: Algeria [https]
 3: Australia (Canberra) [https]      4: Australia (Melbourne 1) [https]
.
.
.
61: USA (TN) [https]                 62: USA (TX 1) [https]
63: Vietnam [https]                  64: (other mirrors)


Selection: 61
Warning: unable to access index for repository https://mirrors.nics.utk.edu/cran                                                                                        /src/contrib:
  download.file(method = "libcurl") is not supported on this platform
Warning message:
package ‘mongolite’ is not available (for R version 3.5.0)
>

Ok it is the same error. I think you need to find a way to get the proxy configured on your computer to access a cran repo. Either by your admin team directly, or by you if they provide you with the information.

About the cran mirror, I suggest using https://cloud.r-project.org/ (Automatic redirection to servers worldwide) that you can configure in the call of install.packages or using options(repos = c(CRAN = "https://cloud.r-project.org/")) before.

Otherwise, it seems you are working in an offline environment. You can ask your admin team if they can provide with an internal CRAN mirror using linux rsync tool for example. (it is what we have at my place of work)
On the R side, you have minicran that can help you build a local cran mirror with the package you need, on an online computer. Then you transfer this repo to your offline server and connect to this repo for installation.
See the vignette for help on this solution.