BiocCheck installation cannot install scripts; thus "R CMD BiocCheck" fails

Thanks for the push @jeroen @native-api I think this will fix all pure R package installations, but could still leave BiocCheck broken or any other package with executables, which is needed to check any Bioconductor package.

The problem here is, that BiocCheck has some executables, which are by default copied into the $R_HOME/bin/ location. And this fix will not help here and will leave the user to copy it manually and setup the PATH env. Not sure what the solution could be here except making $R_HOME/bin writable (but see the caching comment here https://github.com/travis-ci/travis-build/pull/1956#issuecomment-687762524). The current error message is and can be found here (https://travis-ci.com/github/c-mertes/FRASER/jobs/381024156):

begin installing package ‘BiocCheck’
* installing *source* package ‘BiocCheck’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Failed to copy the script/BiocCheck or script/BiocCheckGitClone script
to /opt/R/4.0.2/lib/R/bin. If you want to be able to run 'R CMD
BiocCheck' you'll need to copy it yourself to a directory on your PATH,
making sure it is executable. See the BiocCheck vignette for more
information.
** testing if installed package can be loaded from final location
Failed to copy the script/BiocCheck or script/BiocCheckGitClone script
to /opt/R/4.0.2/lib/R/bin. If you want to be able to run 'R CMD
BiocCheck' you'll need to copy it yourself to a directory on your PATH,
making sure it is executable. See the BiocCheck vignette for more
information.
** testing if installed package keeps a record of temporary installation path
* DONE (BiocCheck)

@c-mertes I believe with https://github.com/travis-ci/travis-build/pull/1957 , BiocCheck will be installing binaries to a writable location as well.

1 Like

Hi all
not sure what I do wrong, but for me it does not look fixed completely.

I have setup a test repo with a plain R package and some tests. But as already mentioned it still fails to install BiocCheck’s executable. Hence I can not run BiocCheck.

You can see it below (I just ran it with the cache deleted):
https://travis-ci.com/github/c-mertes/test-ci
https://travis-ci.com/github/c-mertes/FRASER

In addition, somehow it does not install nor configure bioconductor if using bioc-release.
It gets installed by this command which should not happen as it should be configured in at least bioc-release and bioc-devel or?:

R -e 'if(!requireNamespace("BiocManager")) install.packages("BiocManager")'

@richelbilderbeek can you post a link to your successful build?

@jeroen how to check which travis build version is used? as the

travis-build version: 445df621

given in my builds do not correspond to any commit in https://github.com/travis-ci/travis-build

@c-mertes: sure, here is a passing Bioconductor build (it fails later, due to rJava though). I hope that helps :+1:

@richelbilderbeek thanks for the link. It looks like you just use Bioconductor packages but do not use BiocCheck to test your package. Hence you do not run into this problem.

So the copying of the executable is still a problem, also for potential other packages.
At least I found a workaround for BiocCheck.

# instead of using R CMD (fails)
R CMD BiocCheck *tar.gz

# use BiocCheck as package within R on the source directory (works)
R -e 'BiocCheck::BiocCheck(".")

The first fails as it searches for the BiocCheck executable usually installed into $R_HOME/lib/R/bin/BiocCheck which is a wrapper script to call BiocCheck::BiocCheck() within R. This is essentially the second approach which works.

This is because you override install: where this logic currently is.

@jeroen @jimhester In this light, I believe the Bioconductor and packages installation should be at the setup phase while install: proper should only contain DESCRIPTION-based parts:

Travis allows you to run sudo command, so if you really want to mess with the installation, I guess you can do:

sudo R CMD BiocCheck *tar.gz

But I think it is bad practice to modify the R installation when running checks. So if you can make it work with R -e 'BiocCheck::BiocCheck(".") that seems much better to me.

1 Like

@jeroen Since R doesn’t have a per-user directory for scripts to complement R_LIBS_USER, this is a problem of not Travis but rather of R and/or r Apt package maintainers. So we have to roll with its Linux-unfriendly design decision until that changes.

I see a few options here (in the order of preference):

  1. We can allow travis to create new files in $R_HOME/bin while disallowing messing with existing ones:

    R_BIN=$(Rscript -e 'cat(Sys.getenv("R_HOME"))')/bin
    sudo chgrp "$(id -g)" "$R_BIN"
    sudo chmod g+w,o+t "$R_BIN"
    unset R_BIN
    

    Then Rscript -e 'BiocManager::install("BiocCheck")' installs scripts successfully, as would other packages with scripts. It will complain about not being able to update a few packages in /opt.

  2. We can install BiocCheck as root:

    sudo -E $(which Rscript) -e 'BiocManager::install("BiocCheck")'
    

    Then its installation succeeds, and it reports a few outdated packages in /opt (without complaining about not being able to update them but still not actually updating). But installation of any other package with scripts would fail. Also any possible later attempt to manage the BiocCheck installation as travis would fail.

  3. We can copy the scripts into $R_HOME/bin manually:

    sudo cp -t $(Rscript -e 'cat(Sys.getenv("R_HOME"))')/bin "$R_LIBS_USER/BiocCheck/scripts/BiocCheck"{,GitClone}
    
  4. If none of the above is used, we must document that scripts are not supported, and any package that uses them, including BiocCheck, will either fail to install or will install without scripts and must be used some other way (as BiocCheck currently does).

1 Like

thanks. I figured this out after looking at the code. I think your changes make more then sense. So the user still can change something in the install while using the travis logic to install R/bioc packages too.

This is a PR that implements option 1:

R packages installing scripts is against CRAN policy

Installing into the system’s R installation (e.g., scripts to its bin directory) is not allowed.

Bioconductor is of course not CRAN, but supporting this for arbitrary packages is not something we need to worry about.

Special casing this just so BiocCheck works would be sufficient.

1 Like

But BiocCheck is only installed by the stock logic if there’s bioc_check: true specified – and in this case, it’s then called via Rscript by the stock logic, too.

So to “special case it so that R CMD BiocCheck works” is impossible because the filesystem cannot distinguish whether it’s BiocCheck installation trying to write to $R_HOME/bin or something else.

Imprint