r-lib / pkgdepends

R Package Dependency Resolution
https://r-lib.github.io/pkgdepends/
Other
102 stars 30 forks source link

Error on R 4.4.0 #363

Closed pawelru closed 6 months ago

pawelru commented 6 months ago
r$> x <- pkgdepends::new_pkg_deps("pkgdepends")
r$> x$solve()
Error in `.make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version)`:
! invalid non-character version specification 'x' (type: double)
Type .Last.error to see the more details.
r$> traceback()
18: base::stop(cond)
17: throw(add_class(args[[1]], c("rlib_error_3_0", "rlib_error"), 
        "end"), frame = parent.frame())
16: stop(e)
15: lst$cb(err)
14: ee__error_callback(self, private, err, res)
13: callback(recerror, result)
12: call_with_callback(task$data$func, task$callback, info = task$data$error_info)
11: el__run_pending(self, private)
10: private$run_pending()
9: el_run(self, private, mode = match.arg(mode))
8: new_el$run("once")
7: asNamespace("pkgcache")$synchronise(...)
6: synchronise(self$async_resolve())
5: pkgplan_resolve(self, private)
4: self$resolve()
3: pkgplan_solve(self, private, match.arg(policy))
2: private$plan$solve(policy = private$policy)
1: x$solve()
r$> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.3

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Zurich
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.4.0    R6_2.5.1          cli_3.6.2        
 [4] pkgcache_2.2.2    tools_4.4.0       pillar_1.9.0     
 [7] glue_1.7.0        rstudioapi_0.16.0 curl_5.2.1       
[10] utf8_1.2.4        fansi_1.0.6       vctrs_0.6.5      
[13] filelock_1.0.3    jsonlite_1.8.8    lifecycle_1.0.4  
[16] rlang_1.1.3       pkgdepends_0.7.2 

This is probably connected with this: https://stat.ethz.ch/pipermail/r-devel/2023-July/082723.html

gaborcsardi commented 6 months ago

I can't reproduce this:

❯ x <- pkgdepends::new_pkg_deps("pkgdepends")
❯ x$solve()
✔ Loading metadata database ... done
❯ packageVersion("pkgdepends")
[1] ‘0.7.2’
pawelru commented 6 months ago

Are you on R 4.4.0? I just installed this today and got this.

gaborcsardi commented 6 months ago
❯ packageVersion("pkgcache")
[1] ‘2.2.2’

❯ getRversion()
[1] ‘4.4.0’
gaborcsardi commented 6 months ago

You can try tracing .make_numeric_version().

pawelru commented 6 months ago

Thanks for the hint. I introduced a debug statement and after a few of correct runs I managed to find the following:

Browse[1]> c
Tracing .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) on entry 
Called from: asNamespace("rstudioapi")$getVersion()

Browse[1]> x
[1] 0

Browse[1]> typeof(x)
[1] "double"

Browse[1]> asNamespace("rstudioapi")$getVersion
function() {
    numeric_version(0)
}
<environment: 0x108ad2818>
gaborcsardi commented 6 months ago

I have:

> packageVersion("rstudioapi")
[1] ‘0.15.0’

but it seems to work with version 0.16.0 as well.

pawelru commented 6 months ago

Going deeper into this:

r$> packageVersion("rstudioapi")
[1] ‘0.16.0’

r$> rstudioapi::getVersion()
Error in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) : 
  invalid non-character version specification 'x' (type: double)

r$> rstudioapi::versionInfo()
Error in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) : 
  invalid non-character version specification 'x' (type: double)

r$> rstudioapi::versionInfo
function() {
    list(
        citation = "",
        mode = "vscode",
        version = numeric_version(0),
        release_name = "vscode"
    )
}
<environment: 0x10dc18e18>
pawelru commented 6 months ago

Next step:

r$> environment(rstudioapi:::findFun)$.vsc_rstudioapi_env$versionInfo
function() {
    list(
        citation = "",
        mode = "vscode",
        version = numeric_version(0),
        release_name = "vscode"
    )
}
<environment: 0x152094018>

But now I don't really know where .vsc_rstudioapi_env is defined...

pawelru commented 6 months ago

ok got it https://github.com/REditorSupport/vscode-R/blob/v2.8.2/R/session/rstudioapi.R#L240

I guess that means that you can close the issue

pawelru commented 6 months ago

FYI: https://github.com/REditorSupport/vscode-R/pull/1520