r-lib/remotes

Error converted from warning prevents package install when dependency was built under newer R version

psolymos opened this issue · 23 comments

I am having R version 3.6.0 in Windows, and when I try to use remotes::install_github I get this an error converted from a warning that package 'x' was built under R version 3.6.1. I was trying to override the behaviour at the function call level using dependencies=FALSE to no avail.

> remotes::install_github("psolymos/bSims")
Downloading GitHub repo psolymos/bSims@master
[...]
* installing *source* package 'bSims' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package 'mefa4' was built under R version 3.6.1
Execution halted
ERROR: lazy loading failed for package 'bSims'
* removing 'C:/R/R-3.6.0/library/bSims'
* restoring previous 'C:/R/R-3.6.0/library/bSims'
Error in i.p(...) : 
  (converted from warning) installation of packageC:/Users/PETERS~1/AppData/Local/Temp/RtmpSssGwE/file3d706900445a/bSims_0.1-2.tar.gzhad non-zero exit status

> remotes::install_github("psolymos/bSims", dependencies=FALSE)
Downloading GitHub repo psolymos/bSims@master
[...]  
* installing *source* package 'bSims' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package 'mefa4' was built under R version 3.6.1
Execution halted
ERROR: lazy loading failed for package 'bSims'
* removing 'C:/R/R-3.6.0/library/bSims'
* restoring previous 'C:/R/R-3.6.0/library/bSims'
Error in i.p(...) : 
  (converted from warning) installation of packageC:/Users/PETERS~1/AppData/Local/Temp/RtmpSssGwE/file3d7038435b8a/bSims_0.1-2.tar.gzhad non-zero exit status

Is this warning-to-error conversion really necessary in this case? Seems to me a bit overkill for same major R version.

See R_REMOTES_NO_ERRORS_FROM_WARNINGS at https://github.com/r-lib/remotes#environment-variables.

Worked. Thanks.

Just a short comment in case you are considering to change this default setting of remotes.

The functionality to easily install from Github you provide is really great. But I found it extremely confusing that warnings are by default converted to errors. It took me a lot of time to figure out why the installations of some Github packages did not work. For me it would have been much easier if you had followed the default R convention to only throw an error if somebody set options(warn=2).

When I got such a warning error from devtools:install_github , I wrote several times options(warn=0) and really did not understand what is going on and why I can't install.

I am not sure whether your assessment is empirically true for Github packages:

Warnings usually mean installation errors, so by default remotes stops for a warning.

I think particular on Github there are packages that have been programmed quickly and don't follow all CRAN guidlines. (Several of my own packages are such bad examples). For non CRAN compliant packages there can be many relatively irrelevant warnings like

Warning:  codeUtils/man/codeUtils-package.Rd:32: All text must be in a section

or

Error: (converted from warning) package 'restorepoint' was built under R version 3.6.1

I personally see Github a bit as a land of freedom where I can write quickly packages without spending a lot of time to adhere to all CRAN conventions. But the new remotes default to throw an error if there is a warning basically enforces a lot of CRAN conventions in order to install a package without diving into how to change environment variables.

In short, this is just +1 for not converting warnings to errors by default.

Just want to drop in to join the argument against this default. Failing a package build because of the warning that a different package was built in a slightly newer version seems a bit much... the user could at least be presented with an option to continue, if in interactive mode...

the user could at least be presented with an option to continue, if in interactive mode...

That is not possible, because the installation runs in a subprocess by install.packages().

Even though I am late to this discussion I'd like to give my 2 cents on this. After a lot of searching I found out that the reason why people got an error trying to install my ggcharts package is because of this behavior to convert all warnings to errors.

Most R users on Windows do not install packages from source (due to not having installed Rtools) and thus end up with packages that have been built on newer R versions at one point. In 99.9% of cases this is not an issue and you can safely ignore the warning that package xyz was built under R version x.y.z. In think this is a great example that the statement

Warnings usually mean installation errors

is wrong. I would thus strongly suggest to change this behaviour. After all, why be stricter than install.packages()?

TillF commented

+1 for changing the default behaviour to ignore warnings

It looks like this behaviour is causing a lot of pain so I think we should reconsider. It seems like the other failure mode (apparent install success but actual install failure with warning) is less common.

Hi, I am getting a similar message (shown below) can you please tell me what your resolution was. I am not clear from the thread.
Thanks,
Anita

Error: (converted from warning) package 'ExperimentHub' was built under R version 4.0.2
Execution halted
ERROR: lazy loading failed for package 'sesameData'

See #403 (comment), you can set the environment variable with Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true") from an R session, or put R_REMOTES_NO_ERRORS_FROM_WARNINGS=true in your .Renviron file (open it with usethis::edit_r_environ().

This issue will cause many people difficulty installing R libraries and adopting R. 😬

This issue will cause many people difficulty installing R libraries and adopting R. 😬

What do you mean?

Still seeing this:

Error: (converted from warning) package 'dplyr' was built under R version 4.0.3

Would someone care to fix this? At least give install_ an argument to not convert warnings to errors?

Just a short comment from an outsider given that the discussion seems to continue. If I understand correctly, the issue has been fixed by Jim Hester on August 6th in this commit as is also stated in the package NEWS. Many thanks for changing the default.

It will probably take some time until the fix is on CRAN and more time until most R users have the new remotes version. Probably, little can be done until then.

Users not updating their packages is always an issue, but this report came from a user who claimed they had the latest remotes version from CRAN. Given how many packages have a simple install_github() installation instruction their readme, it would be nice to accelerate deployment to CRAN.

You can control this behavior with an environment variable

R_REMOTES_NO_ERRORS_FROM_WARNINGS="false"

As mentioned in the readme https://github.com/r-lib/remotes#environment-variables

So this is what I put into my readme.md.

# install.packages("remotes")

#Turn off warning-error-conversion, because the tiniest warning stops installation
Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true")

#install from github
remotes::install_github(MYPACKAGE)

I am also still getting this error with many of my GitHub packages even with the new remotes update. This error is particularly frustrating: "Install fails due to "package '...' was built under R version 4.0.X" so install breaks as soon as a new R version is released and CRAN packages are rebuilt.

Adding the bit to the Readme works, but then users either have to know to look there or I have to add the
Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true") instruction everywhere in all my course materials and documentation. For 20+ GitHub packages. What a nightmare.

This is a major obstacle. It would help to have an argument like stopOnWarnings=FALSE and/or describe this problem in the docs.

what's the status of adding functionality to suppress the upgrading of a warning to an error? I just encountered this myself and only surmounted it using @ninohardt recommendation.

@tfalcs The latest release version (2.2.0 on CRAN or github) is from July and thus still converts warnings to errors.
The latest github version of remotes is 2.2.0.9000. It also still converts warnings to errors. It's weird, because commit 5a546ad should have fixed this.
Either way, no progress on this for release versions. Package developers should include some version of what I proposed to reduce error reports from users.

I'm a bit late to this discussion but also would like to add my word.

I strongly suggest changing default behavior as in I'm opinion it's strongly damaging to people that are using R packages from git. Although many of those packages work, they not always follow all CRAN rules, for instance for clean documentation. Keep in mind that installation loads dependencies of a package. I struggled a lot to fix a problem when one of the dependencies raised replacing imports warning at load and thus installation of other package failed. I ended up downloading the repo with git2r to tmp and installing it from a source which is exactly what remotes::install_git should do... Please at least add a parameter that bypasses that damaging default option.

The default as of remotes 2.3.0 is not to convert warnings to errors. If you want the previous default you can set the environment variable R_REMOTES_NO_ERRORS_FROM_WARNINGS=false