Installation of non-CRAN package requires CRAN mirror

359 views Asked by At

I'm trying to install the INLA package of the R-INLA project on a Linux based computing cluster. The package is not on CRAN. According to their tutorial, it suffices to use

install.packages("INLA",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"), dep=TRUE)

for installation, which works perfectly fine on my local machine. However, on the computing cluster, seemingly a CRAN mirror is required to run this command and I get the following error:

Error in contrib.url(repos, type) : 
  trying to use CRAN without setting a mirror
Calls: install.packages -> startsWith -> contrib.url
Execution halted

As an alternative, I tried to install the package directly from the corresponding GitHub repository using devtools. For some reason, this gives me the obviously incorrect version number INLA_99.99.9999. This prohibits me from manually adding the necessary binaries via INLA:::inla.binary.install() as the version number is not found. Any help is appreciated!

1

There are 1 answers

0
Dirk is no longer here On BEST ANSWER

You are relying on the (R global) options() having a valid repos entry on the cluster.

Which you ... cannot as base R ships (in source from) without such as base R Core feels, rightly or wrongly, that they cannot play favourites and set one. Some of us think that is wrong (as it diminishes the user experience -- like yours here) so in the Debian (and hence Ubuntu) package I set this to the 'cloud' mirror everybody is close to as it is on a CDN:

edd@rob:~$ tail -6 /usr/lib/R/etc/Rprofile.site 
## We set the cloud mirror, which is 'network-close' to everybody, as default
local({
    r <- getOption("repos")
    r["CRAN"] <- "https://cloud.r-project.org"
    options(repos = r)
})
edd@rob:~$ 

I suggest you do the same, maybe in ~/.Rprofile, on the cluster.