Compiling error while installing a package after updating R - r

I have recently updated my R to the latest version, 4, and I am getting an error while installing a certain package that I had before. So the error I get is as follow:
> devtools::install_github("ShirinG/exprAnalysis", build_vignettes=F, ref = "master")
√ checking for file 'C:\Users\a\AppData\Local\Temp\RtmpIj39So\remotes10447cb078e0\ShirinG-exprAnalysis-f615bcf/DESCRIPTION' ...
- preparing 'exprAnalysis': √ checking DESCRIPTION meta-information ... Warning in grepl(e, files, perl = TRUE, ignore.case = TRUE) :
PCRE pattern compilation error
'unrecognized character follows \'
at 'inst\extdata\*' Error in grepl(e, files, perl = TRUE, ignore.case = TRUE) :
invalid regular expression '^\inst\extdata\*' Execution halted Error: Failed to install 'exprAnalysis' from GitHub: System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr: E> * checking for file 'C:\Users\a\AppData\Local\Temp\RtmpIj39So\remotes10447cb078e0\ShirinG-exprAnalysis-f615bcf/DESCRIPTION' ... OK
E> * preparing 'exprAnalysis':
E> * checking DESCRIPTION meta-information ... OK
E> Warning in grepl(e, files, perl = TRUE, ignore.case = TRUE) :
E> PCRE pattern compilation error E> 'unrecognized character follows \'
E> at 'inst\extdata\*' E> Error in grepl(e, files, perl = TRUE, ignore.case = TRUE) :
E> invalid regular expression '^\inst\extdata\*' E> Execution halted
Does any one have any suggestion or solution? I am using rtools4 also.

Related

R Install and Restart fails

I have been working on an R package for work for sometime and have been making updates and installing it to my machine for over a year. For some reason, last month, I can no longer build to source, binary and hence I cannot install and restart.
When I choose the document option:
==> devtools::document(roclets = c('rd', 'collate', 'namespace'))
i Updating LICHospitalR documentation
i Loading LICHospitalR
Writing NAMESPACE
Writing NAMESPACE
Documentation completed
It runs successfully.
Now when I click Install and Restart
==> Rcmd.exe INSTALL --no-multiarch --with-keep.source LICHospitalR
* installing to library 'C:/Users/bha485/Documents/R/win-library/4.1'
* installing *binary* package 'LICHospitalR' ...
cp: unknown option -- )
Try '/usr/bin/cp --help' for more information.
ERROR: installing binary package failed
* removing 'C:/Users/bha485/Documents/R/win-library/4.1/LICHospitalR'
* restoring previous 'C:/Users/bha485/Documents/R/win-library/4.1/LICHospitalR'
Exited with status 1.
Also when I do a check:
==> devtools::check()
i Updating LICHospitalR documentation
i Loading LICHospitalR
Registered S3 method overwritten by 'tune':
method from
required_pkgs.model_spec parsnip
Registered S3 methods overwritten by 'stars':
method from
st_bbox.SpatRaster sf
st_crs.SpatRaster sf
Writing NAMESPACE
Writing NAMESPACE
-- Building ------------------------------------- LICHospitalR --
Setting env vars:
* CFLAGS : -Wall -pedantic -fdiagnostics-color=always
* CXXFLAGS : -Wall -pedantic -fdiagnostics-color=always
* CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
-----------------------------------------------------------------
v checking for file 'C:\Users\bha485\Desktop\LICHospitalR/DESCRIPTION' ...
- preparing 'LICHospitalR': (3.3s)
v checking DESCRIPTION meta-information ...
v checking whether 'INDEX' is up-to-date (929ms)
- installing the package to build vignettes
-----------------------------------
- installing *binary* package 'LICHospitalR' ...
cp: unknown option -- )
Try '/usr/bin/cp --help' for more information.
ERROR: installing binary package failed
- removing 'C:/Users/bha485/AppData/Local/Temp/RtmpQX3Cq3/Rinst1e246e7f3ee6/LICHospitalR'
-----------------------------------
ERROR: package installation failed
Error: System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
E> * checking for file 'C:\Users\bha485\Desktop\LICHospitalR/DESCRIPTION' ... OK
E> * preparing 'LICHospitalR':
E> * checking DESCRIPTION meta-information ... OK
E> * checking whether 'INDEX' is up-to-date ... OK
E> * installing the package to build vignettes
E> -----------------------------------
E> * installing *binary* package 'LICHospitalR' ...
E> cp: unknown option -- )
E> Try '/usr/bin/cp --help' for more information.
E> ERROR: installing binary package failed
E> * removing 'C:/Users/bha485/AppData/Local/Temp/RtmpQX3Cq3/Rinst1e246e7f3ee6/LICHospitalR'
E> -----------------------------------
E> ERROR: package installation failed
Stack trace:
1. devtools::check(, check_dir = dirname(getwd()))
2. withr::with_envvar(pkgbuild::compiler_flags(FALSE), action = "pre ...
3. base:::force(code)
4. pkgbuild::build(pkg$path, tempdir(), args = build_args, quiet = q ...
5. withr::with_temp_libpaths(rcmd_build_tools(options$cmd, c(options ...
6. base:::force(code)
7. pkgbuild:::rcmd_build_tools(options$cmd, c(options$path, options$ ...
8. pkgbuild:::with_build_tools(callr::rcmd_safe(..., env = env, ...
9. withr::with_path(rtools_path(), code)
10. base:::force(code)
11. callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE, ...
12. callr:::run_r(options)
13. base:::with(options, with_envvar(env, do.call(processx::run, ...
14. base:::with.default(options, with_envvar(env, do.call(processx::r ...
15. base:::eval(substitute(expr), data, enclos = parent.frame())
16. base:::eval(substitute(expr), data, enclos = parent.frame())
17. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args ...
18. base:::force(code)
19. base:::do.call(processx::run, c(list(bin, args = real_cmdargs, ...
20. (function (command = NULL, args = character(), error_on_status = TRUE, ...
21. throw(new_process_error(res, call = sys.call(), echo = echo, ...
x System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
E> * checking for file 'C:\Users\bha485\Desktop\LICHospitalR/DESCRIPTION' ... OK
E> * preparing 'LICHospitalR':
E> * checking DESCRIPTION meta-information ... OK
E> * checking whether 'INDEX' is up-to-date ... OK
E> * installing the package to build vignettes
E> -----------------------------------
E> * installing *binary* package 'LICHospitalR' ...
E> cp: unknown option -- )
E> Try '/usr/bin/cp --help' for more information.
E> ERROR: installing binary package failed
E> * removing 'C:/Users/bha485/AppData/Local/Temp/RtmpQX3Cq3/Rinst1e246e7f3ee6/LICHospitalR'
E> -----------------------------------
E> ERROR: package installation failed
Execution halted
Exited with status 1.
Session Info:
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0
>
I really do not know where to go from here, should I file this as an issue on the github rstudio/rstudio? Or is there another avenue I can take.
UPDATE
GitHub of Project

Error: processing vignette 'QuickStart.Rmd' failed with diagnostics: there is no package called 'utf8'

I am now updating the package version to 0.2.1 on CRAN.
After doing, devtools::check_rhub(), the error said:
checking re-building of vignette outputs (1.9s)
Error(s) in re-building vignettes:
...
--- re-building 'QuickStart.Rmd' using rmarkdown
Quitting from lines 74-75 (QuickStart.Rmd)
Error: processing vignette 'QuickStart.Rmd' failed with diagnostics:
there is no package called 'utf8'
--- failed re-building 'QuickStart.Rmd'
SUMMARY: processing the following file failed:
'QuickStart.Rmd'
Error: Vignette re-building failed.
Execution halted
And I checked the code from lines 74-75 is
generate_ts(n.ts = 3, freq = 12, nComp = 2, n = 120, output_format = "tsibble")
I tried to add library(utf8) in vignette then I get an error from devtools::check(cran=TRUE) said:
checking for unstated dependencies in vignettes ... NOTE
'library' or 'require' call not declared from: 'utf8'
I tried to add both library(utf8) in vignette and utf8 in DESCRIPTION, but this further led an error
checking package dependencies ... ERROR
The suggested packages are required for a complete check.
Checking can be attempted without them by setting the environment
variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
See section 'The DESCRIPTION file' in the 'Writing R Extensions'
manual.
Anyone know how to fix this problem?
Other codes in vignette
title: "Introduction to gratis"
author: "Bocong Zhao"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Introduction to gratis}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
{r initial, echo = FALSE, cache = FALSE, results = 'hide'}
library(knitr)
opts_chunk$set(
warning = FALSE, message = FALSE, echo = TRUE,
fig.width = 7, fig.height = 6, fig.align = 'centre',
comment = "#>"
)
{r, message=FALSE, include = FALSE}
library(forecast)
library(tsibble)
library(utf8)
Reference answer from this website,
github.com/r-hub/rhub/issues/374
Runing this code would fix the issue devtools::check_rhub(env_vars=c(R_COMPILE_AND_INSTALL_PACKAGES = "always"))

Unable to Install devtools in R on Jenkins

I'm building a Jenkins Job to test a library.
I'm doing most of the scripts work in the r-base docker image.
When I try to install dev tools via Rscript -e
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE) # create personal library
.libPaths(Sys.getenv("R_LIBS_USER")) # add to the path
install.packages("devtools")
install_allstate_github <- function(user, repo, ...) {
tmp_dir <- "$app_dir/ravenclaw"
devtools::install(tmp_dir, dependencies = TRUE)
}
install_allstate_github("SortingHat", "ravenclaw")
library(ravenclaw)
I get the following error
Warning message:
In dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE) :
'/export/home/compjenk/workspace/ISG-Sorting-Hat/Ravenclaw/r-libs' already exists
Installing package into ���/export/home/compjenk/workspace/ISG-Sorting-Hat/Ravenclaw/r-libs���
(as ���lib��� is unspecified)
Warning: unable to access index for repository https://****:****#artifactory.allstate.com/artifactory/cran/src/contrib:
cannot open URL 'https://****:****#artifactory.allstate.com/artifactory/cran/src/contrib/PACKAGES'
Warning messages:
1: In gzfile(file, "rb") :
cannot open compressed file '/tmp/RtmpQGoABw/repos_https://****:****#artifactory.allstate.com/artifactory/cran/src/contrib.rds', probable reason 'No such file or directory'
2: package ���devtools��� is not available (for R version 4.0.2)
Error in loadNamespace(name) : there is no package called ���devtools���
Calls: install_allstate_github ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
I've set the corporate CRAN server in .Rprofile as well as Proxy information but it doesn't seem to help.
.Rprofile
local({
r <- list("cran" = "https://****:****#artifactory.allstate.com/artifactory/cran/")
options(repos = r)
options(RCurlOptions = list(ssl.verifypeer = FALSE,
ssl.verify = FALSE,
proxy = "http://webproxy:8080"))
#set_config( config( ssl_verifypeer = 0L ) )
Sys.setenv(http_proxy = "http://webproxy:8080")
Sys.setenv(https_proxy = "https://webproxy:8080")
So What am I missing or doing wrong? why can't I install devTools?

Error on the stan file compilation using R 3.6.0. and Win 10

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! Error in .shlib_internal(commandArgs(TRUE)) :
C++14 standard requested but CXX14 is not defined
Calls: <Anonymous> -> .shlib_internal
Execution halted
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command 'C:/PROGRA~1/R/R-36~1.0/bin/x64/R CMD SHLIB file1a1860a0379.cpp 2> file1a1860a0379.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
Some non-English page said that we can overcome by executing the following R script, but it did not work in my case:
dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR))
dir.create(dotR)
M <- file.path(dotR, "Makevars")
if (!file.exists(M))
file.create(M)
cat("\nCXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function",
"CXX14 = g++ -std=c++1y",
file = M, sep = "\n", append = TRUE)
The above R script is same as in the following page:
https://github.com/stan-dev/rstan/issues/569
I tried to uninstall and install according to the following page, but the above error occurred.
Rstan installation: https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
REF; https://github.com/stan-dev/stan/issues/1613
ref: https://github.com/stan-dev/rstan/issues/633
For me, the issue has been solved by adding manually the following line into the file .R/Makevars.win.
CXX14 = "C:\Rtools\mingw_64\bin\g++.exe"

Error building vignettes for R package

On a new installation of R on Windows 10, I'm having a problem building vignettes for any package. I can manually use knitr to build my vignettes, but when running any of these commands:
devtools::install_github("hadley/devtools", build_vignettes = TRUE, force = TRUE)
devtools::check(document = FALSE)
devtools::install(build_vignettes = TRUE)
While my example URL had devtools, I get identical error from other packages - e.g.
devtools::install_github("CUD2V/pccc", build_vignettes = TRUE, force = TRUE)
I get output like the following:
devtools::install_github("hadley/devtools", build_vignettes = TRUE, force = TRUE)
Downloading GitHub repo hadley/devtools#master
from URL https://api.github.com/repos/hadley/devtools/zipball/master
Installing devtools
Downloading GitHub repo r-hub/rhub#master
from URL https://api.github.com/repos/r-hub/rhub/zipball/master
Installing rhub
Installation failed: install_packages(package_name, repos = remote$repos, type = remote$pkg_type, dependencies = NA, ..., quiet = quiet, out_dir = out_dir, skip_if_log_exists = skip_if_log_exists) : formal argument "repos" matched by multiple actual arguments
Installation failed: install_packages(package_name, repos = remote$repos, type = remote$pkg_type, dependencies = NA, ..., quiet = quiet, out_dir = out_dir, skip_if_log_exists = skip_if_log_exists) : formal argument "repos" matched by multiple actual arguments
Installation failed: install_packages(package_name, repos = remote$repos, type = remote$pkg_type, dependencies = NA, ..., quiet = quiet, out_dir = out_dir, skip_if_log_exists = skip_if_log_exists) : formal argument "repos" matched by multiple actual arguments
Installation failed: install_packages(package_name, repos = remote$repos, type = remote$pkg_type, dependencies = NA, ..., quiet = quiet, out_dir = out_dir, skip_if_log_exists = skip_if_log_exists) : formal argument "repos" matched by multiple actual arguments
Running command C:/PROGRA~1/R/R-34~1.3/bin/x64/Rcmd.exe
Arguments:
INSTALL
C:/Users/username/AppData/Local/Temp/RtmpIJj3Sj/devtools33e84f791ef2/r-hub-rhub-352458b
--library=C:/Users/username/Documents/R/win-library/3.4
--install-tests
ERROR: dependencies 'parsedate', 'prettyunits', 'rappdirs', 'whoami' are not available for package 'rhub'
* removing 'C:/Users/username/Documents/R/win-library/3.4/rhub'
In R CMD INSTALL
Installation failed: run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback, stderr_callback = real_block_callback, echo_cmd = echo, echo = show, spinner = spinner, error_on_status = fail_on_status, timeout = timeout) : System command error
Running command C:/PROGRA~1/R/R-34~1.3/bin/x64/Rcmd.exe
Arguments:
build
C:\Users\username\AppData\Local\Temp\RtmpIJj3Sj\devtools33e814393089\hadley-devtools-7f5a683
--no-resave-data
--no-manual
* checking for file 'C:\Users\username\AppData\Local\Temp\RtmpIJj3Sj\devtools33e814393089\hadley-devtools-7f5a683/DESCRIPTION' ... OK
* preparing 'devtools':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ...Warning: running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/Rscript" --vanilla --default-packages= -e "tools::buildVignettes(dir = '.', tangle = TRUE)"' had status 1
ERROR
Error: file 'C:/Users/username/AppData/Local/Temp/RtmpU3YzGM/Rbuild2b8017d6415/devtools/DESCRIPTION' is not in valid DCF format
In addition: Warning message:
In read.dcf(dfile, keep.white = .keep_white_description_fields) :
cannot open compressed file 'C:/Users/username/AppData/Local/Temp/RtmpU3YzGM/Rbuild2b8017d6415/devtools/DESCRIPTION', probable reason 'Permission denied'
Execution halted
Installation failed: run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback, stderr_callback = real_block_callback, echo_cmd = echo, echo = show, spinner = spinner, error_on_status = fail_on_status, timeout = timeout) : System command error
It appears that although the DESCRIPTION file specifies to use knitr, devtools::install_github and devtools::check is using tools::buildVignettes.
Also, if just running
devtools::build_vignettes
No error is received and vignettes are built.
I also have a macOS machine running current version of R and a Windows 2012 Server running R 3.3.x and both can build vignettes and install packages without getting a similar error.
How do I work around these build errors?
#alistaire noticed the dependency errors - after resolving those, I'm still getting the same problem building packages with vignettes, checking packages, etc.:
> devtools::install_github("hadley/devtools", build_vignettes = TRUE, force = TRUE)
Downloading GitHub repo hadley/devtools#master
from URL https://api.github.com/repos/hadley/devtools/zipball/master
Installing devtools
Running command C:/PROGRA~1/R/R-34~1.3/bin/x64/Rcmd.exe
Arguments:
build
C:\Users\username\AppData\Local\Temp\RtmpQpK5Yi\devtools25f4138c52c3\hadley-devtools-7f5a683
--no-resave-data
--no-manual
* checking for file 'C:\Users\username\AppData\Local\Temp\RtmpQpK5Yi\devtools25f4138c52c3\hadley-devtools-7f5a683/DESCRIPTION' ... OK
* preparing 'devtools':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ...Warning: running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/Rscript" --vanilla --default-packages= -e "tools::buildVignettes(dir = '.', tangle = TRUE)"' had status 1
ERROR
Error: file 'C:/Users/username/AppData/Local/Temp/RtmpKe9Atv/Rbuild24501e281f1c/devtools/DESCRIPTION' is not in valid DCF format
In addition: Warning message:
In read.dcf(dfile, keep.white = .keep_white_description_fields) :
cannot open compressed file 'C:/Users/username/AppData/Local/Temp/RtmpKe9Atv/Rbuild24501e281f1c/devtools/DESCRIPTION', probable reason 'Permission denied'
Execution halted
Installation failed: run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback, stderr_callback = real_block_callback, echo_cmd = echo, echo = show, spinner = spinner, error_on_status = fail_on_status, timeout = timeout) : System command error
Although the message references permission denied, these errors appear to occur regardless of user permissions. I've run as my regular user and as Administrator.

Resources