Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install_github Error (converted from warning) #2084

Closed
jrowen opened this issue Jul 30, 2019 · 10 comments
Closed

install_github Error (converted from warning) #2084

jrowen opened this issue Jul 30, 2019 · 10 comments

Comments

@jrowen
Copy link

jrowen commented Jul 30, 2019

I'm running into an "Error (converted from warning)" message when using install_github to install on a Centos7 machine running R 3.6 (see error below).

sudo R -e "devtools::install_github('rstudio/shinyloadtest', INSTALL_opts = c('--no-html'))"

R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
...
installing to /usr/lib64/R/library/00LOCK-rlang/00new/rlang/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
Error in file.copy(file.path(R.home("doc"), "html", "R.css"), outman) :
  (converted from warning) problem copying /usr/share/doc/R-3.6.0/html/R.css to /usr/lib64/R/library/00LOCK-rlang/00new/rlang/html/R.css: No such file or directory
* removing ‘/usr/lib64/R/library/rlang’
* restoring previous ‘/usr/lib64/R/library/rlang’
Error in i.p(...) :
  (converted from warning) installation of package ‘rlang’ had non-zero exit status
Calls: <Anonymous> ... with_rprofile_user -> with_envvar -> force -> force -> i.p
Execution halted

On the other hand, if I install the problem library individually, I don't run into any errors.

sudo R -e "install.packages(c('rlang'), repos=c('https://cloud.r-project.org/'))"
...
* DONE (rlang)
Warning in file.create(f.tg) :
  cannot create file '/usr/share/doc/R-3.6.0/html/packages.html', reason 'No such file or directory'
Warning in utils::make.packages.html(.Library, docdir = R.home("doc")) :
  cannot update HTML package index

The downloaded source packages are in
        ‘/tmp/Rtmp2AJsYo/downloaded_packages’
Updating HTML index of packages in '.Library'
Warning messages:
1: In file.create(f.tg) :
  cannot create file '/usr/share/doc/R-3.6.0/html/packages.html', reason 'No such file or directory'
2: In make.packages.html(.Library) : cannot update HTML package index
>
>

Now, if I run install_github on the original library, the process proceeds along until eventually encountering a similar error on another dependency.

* installing *source* package ‘clipr’ ...
** package ‘clipr’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
Error in file.copy(file.path(R.home("doc"), "html", "R.css"), outman) :
  (converted from warning) problem copying /usr/share/doc/R-3.6.0/html/R.css to /usr/lib64/R/library/00LOCK-clipr/00new/clipr/html/R.css: No such file or directory
* removing ‘/usr/lib64/R/library/clipr’
* restoring previous ‘/usr/lib64/R/library/clipr’
Error in i.p(...) :
  (converted from warning) installation of package ‘clipr’ had non-zero exit status
Calls: <Anonymous> ... with_rprofile_user -> with_envvar -> force -> force -> i.p
Execution halted

This seems to be related to warnings being elevated to errors at some point along the installation process. Any guidance on how to resolve these errors would be appreciated.

@jimhester
Copy link
Member

I don't know why the copying errors are happening, likely the cause is due to the permissions on the files or directories you are trying to install into. Likely you or someone else installed some packages as root or a different user, and your current user does not have permissions to write to them.

You can set the shell environment variable R_REMOTES_NO_ERRORS_FROM_WARNINGS=true to avoid turning installation warnings to errors, but this will only mask the problem, and you may end up with broken packages with some files from the old version of the package and some with the new version.

The best solution would be for you to fix the permission issues.

In any case this is not an issue with devtools or remotes, so I will close this issue.

@jimhester
Copy link
Member

Possibly the issue is you are trying to install with sudo and subprocesses launched by R are not inheriting the superuser rights. I would recommend not using sudo when installing packages.

@jrowen
Copy link
Author

jrowen commented Jul 30, 2019

I'm seeing the same error when running without sudo. Taking your advice, I'm also finding

$ ls -la /usr/share/doc/R-3.6.0/html/R.css
ls: cannot access /usr/share/doc/R-3.6.0/html/R.css: No such file or directory

$ ls -la /usr/share/doc/R-3.6.0/
total 16
drwxr-xr-x 3 root root 4096 Jul 30 12:51 .
drwxr-xr-x 1 root root 4096 Jul 30 12:51 ..
drwxr-xr-x 2 root root 4096 May 31 18:43 manual

It appears that some of the html files are missing from my R installation, which came from EPEL and yum install R R-devel. I'm only seeing these errors when installing with devtools, (e.g. install_github and install_version), which I'm guessing is due to warnings being elevated to errors in these functions.

@emilmahler
Copy link

@jrowen did you find a solution? I'm faced with the same issue.

@kenahoo
Copy link

kenahoo commented Sep 9, 2019

The problem isn't permissions in this case, it's that the files that are attempting to be copied don't exist:

*** installing help indices
Error in file.copy(file.path(R.home("doc"), "html", "R.css"), outman) :
  (converted from warning) problem copying /usr/share/doc/R-3.6.0/html/R.css to 
/usr/lib64/R/library/00LOCK-rlang/00new/rlang/html/R.css: No such file or directory

If you look in /usr/share/doc/R-3.6.0, you'll probably see that the file html/R.css doesn't exist. At least, that's what I see when I get this error.

I feel like this should have been prevented by your INSTALL_opts = c('--no-html') argument in the call, but it looks like maybe that doesn't get propagated down to the right level.

In any case - a workaround might be the following:

  • Manually create the directory /usr/share/doc/R-3.6.0/html
  • Use INSTALL_opts=c("--no-help", "--no-html") to prevent all docs from being created, so the file-not-found error doesn't happen

In my testing this seems to do the trick.

@kenahoo
Copy link

kenahoo commented Sep 9, 2019

@emilmahler @jrowen - another option might be to use INSTALL_opts="--no-docs" or INSTALL_opts=c("--no-docs", "--no-help"), that seems to be somewhat broader than --no-html.

These options aren't really documented in any detail anywhere, so the best source for what they do might be the file src/library/tools/R/install.R in the R source.

@jimhester
Copy link
Member

I think you should fix your R installation and copy the documentation to the place R expects. e.g. In my opinion the centos RPM is broken if it does not do this by default.

mkdir -p /usr/share/doc/R-3.6.0/html
cp /usr/lib64/R/library/stats/html/R.css /usr/share/doc/R-3.6.0/html/

@kenahoo
Copy link

kenahoo commented Sep 12, 2019

@jimhester That's indeed what I do on my CentOS boxes, but if the user doesn't have root permissions on the box, this may not be an option.

When was the "error converted from warning" behavior added to devtools? I don't see anything in NEWS.md but this is of course a breaking change. Was it a consequence of switching to remotes or pkgbuild internals or something?

@kenahoo
Copy link

kenahoo commented Sep 12, 2019

@emilmahler @jrowen - specifically, what you can do to eliminate the warnings-turned-errors for a particular installation, if you have permission, is this:

Rscript -e 'x <- file.path(R.home("doc"), "html"); if (!file.exists(x)) {dir.create(x, recursive=TRUE); file.copy(system.file("html/R.css", package="stats"), x)}'

I have that in Dockerfile definitions to silence these warnings.

@lock
Copy link

lock bot commented Mar 10, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants