Closed mgriffiths2 closed 1 year ago
Do you get more detail if you use:
options(error = renv:::renv_error_handler_call())
options(warn = 2L)
Perhaps by putting this in your project's .Rprofile
before source("renv/activate.R")
is run?
A reproducible example would also help; e.g. if you could share your project sources publicly (e.g. on GitHub).
Unfortunately I'm not able to share the whole project. Would the renv lockfile help?
Here is what I get when I load with the options you suggested above:
Error in is.na(value) :
(converted from warning) (converted from warning) is.na() applied to non-(list or vector) of type 'language'
Traceback (most recent calls last):
35: source("renv/activate.R")
34: withVisible(eval(ei, envir))
33: eval(ei, envir)
32: eval(ei, envir)
31: local(...) at activate.R#2
30: eval.parent(substitute(eval(quote(expr), envir)))
29: eval(expr, p)
28: eval(expr, p)
27: eval(quote(...), new.env())
26: eval(quote(...), new.env())
25: if (renv_bootstrap_load(project, libpath, version))
return(TRUE) at activate.R#1159
24: renv::load(project) at activate.R#847
23: renv_load_finish(project, lockfile)
22: renv_load_report_synchronized(project, lockfile)
21: (function() {
renv_scope_options(renv.verbose = FALSE)
status(project = project, sources = FALSE)
})()
20: status(project = project, sources = FALSE)
19: renv_status_impl(project, libpaths, lockpath, sources, cache)
18: renv_snapshot_dependencies(project, dev = FALSE)
17: dynamic(list(project = project, type = type, dev = dev), renv_snapshot_dependencies_impl(project,
type, dev))
16: the$dynamic_objects[[id]] %||% {
dlog("dynamic", "memoizing dynamic value for '%s'", id)
value
}
15: renv_snapshot_dependencies_impl(project, type, dev)
14: withCallingHandlers(renv_dependencies_impl(path = path, root = project,
field = "Package", errors = config$dependency.errors(), dev = dev),
renv.dependencies.problems = function(cnd) {
if (identical(config$dependency.errors(), "ignored"))
return()
if (interactive() && !proceed())
cancel()
}, renv.dependencies.elapsed_time = function(cnd) {
if (!type %in% c("packrat", "implicit"))
return()
elapsed <- cnd$data
limit <- getOption("renv.dependencies.elapsed_time_threshold",
default = 10L)
if (elapsed < limit)
return()
lines <- c("", "NOTE: Dependency discovery took %s during snapshot.",
"Consider using .renvignore to ignore files, or switching to explicit snapshots.",
"See `?renv::dependencies` for more information.",
"")
writef(lines, renv_difftime_format(elapsed))
})
13: renv_dependencies_impl(path = path, root = project, field = "Package",
errors = config$dependency.errors(), dev = dev)
12: renv_dependencies_discover(files, progress, errors)
11: bapply(paths, renv_dependencies_discover_impl)
10: lapply(x, f, ...)
9: FUN(X[[i]], ...)
8: tryCatch(filebacked("dependencies", path, callback), error = function(cnd) {
warning(cnd)
NULL
})
7: tryCatchList(expr, classes, parentenv, handlers)
6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
5: value[[3L]](cond)
4: warning(cnd)
3: withRestarts({
.Internal(.signalCondition(cond, message, call))
.Internal(.dfltWarn(message, call))
}, muffleWarning = function() NULL)
2: withOneRestart(expr, restarts[[1L]])
1: doWithOneRestart(return(expr), restart)
Hi, I also ran into warnings using 'renv::upgrade()' to migrate from 0.17.3 to 1.0.0 as an initial installation of the new version. I can't clarify the issue, but got a quick and dirty workaround:
install.packages()
)renv::activate(project = "your/r-project/to/upgrade")
Anyway, thank you for the renv update!
It seems the error is occurring during dependency-finding:
Finding R package dependencies ... [104/123] Error in is.na(value) : (converted from warning) (converted from warning) is.na() applied to non-(list or vector) of type 'language'
I have now worked around this by specifying my dependencies explicitly in a DESCRIPTION file. I guess the error comes from parsing our code when finding dependencies.
Here is my output:
- Project '/xxxxx/xxxxx' loaded. [renv 1.0.0]
Error in is.na(value) :
(converted from warning) (converted from warning) is.na() applied to non-(list or vector) of type 'language'
Traceback (most recent calls last):
46: local({
try_source <- function(file) {
if (file.exists(file)) {
source(file)
TRUE
}
else {
FALSE
}
}
r_profile <- Sys.getenv("R_PROFILE_USER_OLD")
Sys.setenv(R_PROFILE_USER_OLD = "", R_PROFILE_USER = r_profile)
if (nzchar(r_profile)) {
try_source(r_profile)
}
else {
try_source(".Rprofile") || try_source(file.path("~",
".Rprofile"))
}
invisible()
})
45: eval.parent(substitute(eval(quote(expr), envir)))
44: eval(expr, p)
43: eval(expr, p)
42: eval(quote({
try_source <- function(file) {
if (file.exists(file)) {
source(file)
TRUE
} else {
FALSE
}
}
r_profile <- Sys.getenv("R_PROFILE_USER_OLD")
Sys.setenv(R_PROFILE_USER_OLD = "", R_PROFILE_USER = r_profile)
if (nzchar(r_profile)) {
try_source(r_profile)
} else {
try_source(".Rprofile") || try_source(file.path("~",
".Rprofile"))
}
invisible()
}), new.env())
41: eval(quote({
try_source <- function(file) {
if (file.exists(file)) {
source(file)
TRUE
} else {
FALSE
}
}
r_profile <- Sys.getenv("R_PROFILE_USER_OLD")
Sys.setenv(R_PROFILE_USER_OLD = "", R_PROFILE_USER = r_profile)
if (nzchar(r_profile)) {
try_source(r_profile)
} else {
try_source(".Rprofile") || try_source(file.path("~",
".Rprofile"))
}
invisible()
}), new.env())
40: try_source(".Rprofile")
39: source(file)
38: withVisible(eval(ei, envir))
37: eval(ei, envir)
36: eval(ei, envir)
35: source("renv/activate.R") at .Rprofile#11
34: withVisible(eval(ei, envir))
33: eval(ei, envir)
32: eval(ei, envir)
31: local(...) at activate.R#2
30: eval.parent(substitute(eval(quote(expr), envir)))
29: eval(expr, p)
28: eval(expr, p)
27: eval(quote(...), new.env())
26: eval(quote(...), new.env())
25: if (renv_bootstrap_load(project, libpath, version))
return(TRUE) at activate.R#1159
24: renv::load(project) at activate.R#847
23: renv_load_finish(project, lockfile)
22: renv_load_report_synchronized(project, lockfile)
21: (function() {
renv_scope_options(renv.verbose = FALSE)
status(project = project, sources = FALSE)
})()
20: status(project = project, sources = FALSE)
19: renv_status_impl(project, libpaths, lockpath, sources, cache)
18: renv_snapshot_dependencies(project, dev = FALSE)
17: dynamic(list(project = project, type = type, dev = dev), renv_snapshot_dependencies_impl(project,
type, dev))
16: the$dynamic_objects[[id]] %||% {
dlog("dynamic", "memoizing dynamic value for '%s'", id)
value
}
15: renv_snapshot_dependencies_impl(project, type, dev)
14: withCallingHandlers(renv_dependencies_impl(path = path, root = project,
field = "Package", errors = config$dependency.errors(), dev = dev),
renv.dependencies.problems = function(cnd) {
if (identical(config$dependency.errors(), "ignored"))
return()
if (interactive() && !proceed())
cancel()
}, renv.dependencies.elapsed_time = function(cnd) {
if (!type %in% c("packrat", "implicit"))
return()
elapsed <- cnd$data
limit <- getOption("renv.dependencies.elapsed_time_threshold",
default = 10L)
if (elapsed < limit)
return()
lines <- c("", "NOTE: Dependency discovery took %s during snapshot.",
"Consider using .renvignore to ignore files, or switching to explicit snapshots.",
"See `?renv::dependencies` for more information.",
"")
writef(lines, renv_difftime_format(elapsed))
})
13: renv_dependencies_impl(path = path, root = project, field = "Package",
errors = config$dependency.errors(), dev = dev)
12: renv_dependencies_discover(files, progress, errors)
11: bapply(paths, renv_dependencies_discover_impl)
10: lapply(x, f, ...)
9: FUN(X[[i]], ...)
8: tryCatch(filebacked("dependencies", path, callback), error = function(cnd) {
warning(cnd)
NULL
})
7: tryCatchList(expr, classes, parentenv, handlers)
6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
5: value[[3L]](cond)
4: warning(cnd)
3: withRestarts({
.Internal(.signalCondition(cond, message, call))
.Internal(.dfltWarn(message, call))
}, muffleWarning = function() NULL)
2: withOneRestart(expr, restarts[[1L]])
1: doWithOneRestart(return(expr), restart)
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Platform: x86_64-pc-linux-gnu (64-bit)
@kevinushey, I have a reproducible example. I am seeing a similar error when restarting R after upgrading to renv 1.0.0:
Restarting R session...
- Project '~/GitHub/rtraining' loaded. [renv 1.0.0]
Warning messages:
1: In is.na(value) :
is.na() applied to non-(list or vector) of type 'language'
2: In if (is.na(value)) default else as.logical(value) :
the condition has length > 1
ℹ Loading rtraining
renv/activate.R
(removing this from .Rprofile
eliminates the error).options(error = renv:::renv_error_handler_call()); options(warn = 2L)
) changes the error message but doesn't provide additional detail:Restarting R session...
- Project '~/GitHub/rtraining' loaded. [renv 1.0.0]
Error in is.na(value) :
(converted from warning) (converted from warning) is.na() applied to non-(list or vector) of type 'language'
Interestingly, I performed the upgrade from 0.17.3 to 1.0.0 using the commands:
renv::update("renv")
renv::snapshot()
However, when I try the following I get an error:
> renv::upgrade()
A new version of the renv package will be installed:
# CRAN ===============================
- renv [0.17.3 -> 1.0.0]
This project will use the newly-installed version of renv.
Do you want to proceed? [y/N]: y
Installing renv [1.0.0] ...
OK [linked cache in 0.76 milliseconds]
Warning messages:
1: In runHook(".onLoad", env, package.lib, package) :
internal error -3 in R_decompress1
2: In runHook(".onLoad", env, package.lib, package) :
internal error -3 in R_decompress1
warning messages from top-level task callback 'renv_sandbox_task'
Warning messages:
1: In runHook(".onLoad", env, package.lib, package) :
internal error -3 in R_decompress1
2: renv background task 'renv_sandbox_task' failed; it will be stopped
warning messages from top-level task callback 'renv_snapshot_task'
Warning message:
In runHook(".onLoad", env, package.lib, package) :
internal error -3 in R_decompress1
Error in runHook(".onLoad", env, package.lib, package) :
lazy-load database '/Users/jabenninghoff/Library/Caches/org.R-project.R/R/renv/library/rtraining-be68765c/R-4.3/x86_64-apple-darwin20/renv/R/renv.rdb' is corrupt
In addition: Warning message:
In runHook(".onLoad", env, package.lib, package) :
internal error -3 in R_decompress1
I've upgraded several of my R packages to renv 1.0.0 with no issue; rtraining
is the only one affected - the key difference could be the large number of dependencies in the project.
Hi,
I had the same issue after upgrading to 1.0.0.
The following warnings occured whenever I called renv::status()
or renv::init()
:
Warning messages:
1: In is.na(value) :
is.na() applied to non-(list or vector) of type 'language'
2: In if (is.na(value)) default else as.logical(value) :
the condition has length > 1
I tracked it down to an Rmd-file with the following chunk using a conditional evaluation:
```{r load_data, eval=!use_cache}
...
(The variable use_cache
is defined in a previous chunk.)
I solved this by not using the negation:
```{r load_data, eval=not_use_cache}
...
The warnings disappeared afterwards.
Hope this helps others as well.
I think this is coming from truthy()
when called inside renv_dependencies_discover_chunks_ignore()
.
Looks like the problem was caused in https://github.com/rstudio/renv/commit/314009b6ab456a413af03cb360239923139e57e3#diff-10360dfb4fa51b737341a4b5e8d5ea9758b1dcd3a9fb923349ee866120191a60 by removal of the is.call()
block.
It's probably worth breaking up truthy()
into two functions — one can be used for env vars (90% of the existing usage) and the other for parsing knitr options.
I was using renv 0.17.3 with no problem, then upgraded to 1.0.0 using renv::upgrade()
Now whenever I open my project, or run renv::load() I get a list of warning messages:
It still seems to work fine, but it would be nice to get rid of the warnings.