PredictiveEcology / Require

Simple R package to install and load packages conducive to a reproducible workflow
https://require.predictiveecology.org/
21 stars 6 forks source link

Lack of admin access & install from source failure? #97

Closed CeresBarros closed 1 year ago

CeresBarros commented 1 year ago

I've recently helped someone install SpaDES.core and I think there may be an issue related to lack of admin access and being able to install packages from source.

Here's an outline of the issue (which I can't reproduce on my machine)

options(repos = c(CRAN = "https://cloud.r-project.org"))

## decide where you're working
pkgPath <- file.path( "packages", version$platform,
                     paste0(version$major, ".", strsplit(version$minor, "[.]")[[1]][1]))
dir.create(pkgPath, recursive = TRUE)
.libPaths(pkgPath, include.site = FALSE) ## install packages in project library (proj-lib)

if (!"remotes" %in% installed.packages(lib.loc = pkgPath))
  install.packages("remotes")

if (!"Require" %in% installed.packages(lib.loc = pkgPath) ||
    packageVersion("Require", lib.loc = pkgPath) < "0.3.1") {
  remotes::install_github("PredictiveEcology/Require@55ec169e654214d86be62a0e13e9a2157f1aa966",
                          upgrade = FALSE)
}

## use binary linux packages if on Ubuntu
Require::setLinuxBinaryRepo()

## Notes: 
## 1) if you are working from RStudio and have an older version of base packages like `Rcpp`, `rlang` 
## (and others) installed, you may  need to run the following lines (and code above) directly from R
## in order to update these base packages
## 2) Please ensure the appropriate Rtools version is installed (see)

Require::Require(c("PredictiveEcology/SpaDES.project@transition (HEAD)", 
                   "PredictiveEcology/SpaDES.core@master (HEAD)"),
                 require = FALSE, upgrade = FALSE, standAlone = TRUE)

The last line failed as quickPlot and reproducible could not be installed. Before failure we saw the message that the source version fo the packages was more recent than the binary.

We circumvented the issue by installing the probelmatic dependencies with install.packages which had no issues and (I'm pretty sure) installed the source versions of the packages.

install.packages("quickPlot")
install.packages("reproducible")
Require::Require(c("PredictiveEcology/SpaDES.project@transition (HEAD)", 
                   "PredictiveEcology/SpaDES.core@master (HEAD)"),
                 require = FALSE, upgrade = FALSE, standAlone = TRUE)

I'm unsure what the problem is, as I can't reproduce -- I will try to make another windows user account (with no admin priviledges) to test.

achubaty commented 1 year ago

On windows, you can set an option to prevent checking source versions. From https://stat.ethz.ch/R-manual/R-devel/library/base/html/options.html:

install.packages.check.source: Used by install.packages (and indirectly update.packages) on platforms which support binary packages. Possible values "yes" and "no", with unset being equivalent to "yes".

If installing the latest development versions, prebuild packages can be installed from our R-universe repo:

options(repos = c("https://predictiveecology.r-universe.dev/", getOption("repos")))
CeresBarros commented 1 year ago

Apparently the issue was related to 1) Rtools being installed but not well configured 2) R version too old (4.1.3)

However your points are great, thanks @achubaty