r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 753 forks source link

devtool::test Package independant "Error: invalid version specification ‘0.68’" #2439

Closed stela2502 closed 2 years ago

stela2502 commented 2 years ago

Hi devtools developer, recently I upgraded to Ubuntu 22.04 and R 4.2.1 and out of the blue my package fails tests with an Error: invalid version specification ‘0.68’ I know this error does not come from my package as the test script run line by line in the R interface does not produce such an error. The traceback of the Error:

traceback()
32: stop(gettextf("invalid version specification %s", paste(sQuote(unique(x[!ok])), 
        collapse = ", ")), call. = FALSE, domain = NA)
31: .make_numeric_version(x, strict, .standard_regexps()$valid_R_system_version, 
        c("R_system_version", "package_version"))
30: R_system_version(paste(x[c("major", "minor")], collapse = "."))
29: package_version(list(major = 0, minor = VTE_VERSION))
28: ansi_has_hyperlink_support()
27: cli::style_hyperlink(paste0(basename(filename), ":", x$srcref[1], 
        ":", x$srcref[2]), paste0("file://", file.path(srcfile$wd, 
        filename)), params = c(line = x$srcref[1], col = x$srcref[2]))
26: expectation_location(x)
25: issue_header(x)
24: lapply(list(...), as.character)
23: mypaste(...)
22: crayon::bold(issue_header(x))
21: FUN(X[[i]], ...)
20: vapply(issues, issue_summary, FUN.VALUE = character(1))
19: self$report_issues(self$ctxt_issues)
18: x$end_context(...)
17: FUN(X[[i]], ...)
16: lapply(objects, f)
15: o_apply(self$reporters, "end_context", context)
14: self$end_context(self$.context)
13: reporter$end_context_if_started()
12: FUN(X[[i]], ...)
11: lapply(test_paths, test_one_file, env = env, wrap = wrap)
10: doTryCatch(return(expr), name, parentenv, handler)
9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
8: tryCatchList(expr, classes, parentenv, handlers)
7: tryCatch(code, testthat_abort_reporter = function(cnd) {
       cat(conditionMessage(cnd), "\n")
       NULL
   })
6: with_reporter(reporters$multi, lapply(test_paths, test_one_file, 
       env = env, wrap = wrap))
5: test_files(test_dir = test_dir, test_package = test_package, 
       test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, 
       env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
       wrap = wrap, load_package = load_package)
4: test_files(test_dir = path, test_paths = test_paths, test_package = package, 
       reporter = reporter, load_helpers = load_helpers, env = env, 
       stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
       wrap = wrap, load_package = load_package, parallel = parallel)
3: test_dir(test_path, package = package, reporter = reporter, ..., 
       load_package = if (package != "testthat") "source" else "none")
2: testthat::test_local(pkg$path, filter = filter, stop_on_failure = stop_on_failure, 
       ...)
1: devtools::test(filter = "Wil")

and the package that is not testing is my FastWilcoxTest package: https://github.com/sonejilab/FastWilcoxTest. This is horribly inconvenient as I need to find a bug in that package. Please help me! Thank you!

sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=sv_SE.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=sv_SE.UTF-8    LC_MESSAGES=en_AU.UTF-8   
 [7] LC_PAPER=sv_SE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] FastWilcoxTest_0.1.16 testthat_3.1.4       

loaded via a namespace (and not attached):
 [1] Biobase_2.56.0      pkgload_1.2.4       splines_4.2.1      
 [4] qqconf_1.2.3        brio_1.1.3          sn_2.0.2           
 [7] Rdpack_2.3.1        stats4_4.2.1        TFisher_0.2.0      
[10] remotes_2.4.2       sessioninfo_1.2.2   numDeriv_2016.8-1.1
[13] pillar_1.7.0        lattice_0.20-45     glue_1.6.2         
[16] rbibutils_2.2.8     sandwich_3.0-1      Matrix_1.4-0       
[19] plyr_1.8.7          pkgconfig_2.0.3     devtools_2.4.3     
[22] purrr_0.3.4         mvtnorm_1.1-3       processx_3.5.3     
[25] tibble_3.1.7        usethis_2.1.6       ellipsis_0.3.2     
[28] TH.data_1.1-1       cachem_1.0.6        withr_2.5.0        
[31] BiocGenerics_0.42.0 cli_3.3.0           mnormt_2.1.0       
[34] survival_3.2-13     magrittr_2.0.3      crayon_1.5.1       
[37] memoise_2.0.1       ps_1.7.0            fs_1.5.2           
[40] fansi_1.0.3         MASS_7.3-55         pkgbuild_1.3.1     
[43] tools_4.2.1         prettyunits_1.1.1   lifecycle_1.0.1    
[46] multcomp_1.4-19     mutoss_0.1-12       stringr_1.4.0      
[49] plotrix_3.8-2       callr_3.7.0         compiler_4.2.1     
[52] rlang_1.0.2         grid_4.2.1          rstudioapi_0.13    
[55] waldo_0.4.0         codetools_0.2-18    multtest_2.52.0    
[58] reshape2_1.4.4      R6_2.5.1            zoo_1.8-10         
[61] fastmap_1.1.0       utf8_1.2.2          mathjaxr_1.6-0     
[64] rprojroot_2.0.3     metap_1.8           desc_1.4.1         
[67] stringi_1.7.6       Rcpp_1.0.8.3        vctrs_0.4.1  
jennybc commented 2 years ago

This is unlikely to be a problem with devtools. I suspect it's a problem with your machine, e.g. perhaps some corruption in your package library.

stela2502 commented 2 years ago

Thank you for this info. I will try with a new library and get back to you.

stela2502 commented 2 years ago

It is quite strange, as I actually had installed the system the day before. I had only started to use R the day this issue occurred. But I'll nuke my lib and restart ;-)

stela2502 commented 2 years ago

THANK YOU! This error reproducibly occured when dirt-upgrading from Ubuntu 20.04 to 22.04. And yes removing my whole R library and re-installing everything did do the trick! A whole work day down the drain ;-) But thanks to you not more days!

stela2502 commented 2 years ago

Crap - the error is back. Do you have any idea on how to debug this? I have removed my personal library and re-installed devtools. Seams I do not have the right compiler? Or am I wrong?

stela2502 commented 2 years ago

I really think that is some error in devtools:

> source('tests/testthat/test-entropy.R')
Fehler: Reason: useless and depricated
> devtools::test(filter='entropy')
ℹ Loading FastWilcoxTest
ℹ Testing FastWilcoxTest
✔ | F W S  OK | Context
✔ |     1   0 | entropy                                                                                      
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
Fehler: ungültige Versionsspezifikation ‘0.68’

And the error (Fehler) seams to be some C stuff I do not understand. All - really all - functions work is not started with devtools::test but source. I have even checked the two last functions of the backtrace:

gettextf("some test: %s",sQuote( 2131))
[1] "some test: ‘2131’"

I do not understand this error - can you please help me?

stela2502 commented 2 years ago

Oh and the two relevant lines in the test script are:

context( 'entropy')
skip('useless and depricated')
stela2502 commented 2 years ago

ARGH - now I have hit the bottom of this error:

> R_system_version("4.2")
Fehler: ungültige Versionsspezifikation ‘4.2’
> R_system_version("4.2.3")
[1] ‘4.2.3’

So it is some issue with devtools after all. Could you please check this? It seams what one should do here is a

>numeric_version("0.68")
[1] ‘0.68’
> R_system_version("0.68")
Fehler: ungültige Versionsspezifikation ‘0.68’

Thank you!

stela2502 commented 2 years ago

Hi again. It was the cli package. Installing that one from github instead of cran fixed my problem.

krassowski commented 2 years ago

I also experience this on Ubuntu 22.04, triggered by devtools::test() after tests run through. After installing cli from GitHub and restarting R session the problem went away (but there might be another explanation).

stela2502 commented 2 years ago

I wonder how you get to you statement "but there might be another explanation". The error was thrown by the cli package and installing an update of the package solved the problem. Can you please come up with another explanation if you assume there is one? Or is that your general strategy?

bbolker commented 2 years ago

I think this is fixed in https://github.com/r-lib/cli/pull/452 . This was unfortunately merged one day after (26 April 2022) the last cli version on CRAN. The underlying problem is with the environment variable VTE_VERSION, which is incorrectly handled by cli.

stela2502 commented 2 years ago

I was going to link this here, too. bbolker - Thank you!