Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

r - devtools::check() - no package called ‘Matrix’

I want to prepare my first package for CRAN, and continuously facing this error

when in Rstudio:


> devtools::check(args = c('--as-cran'))

the ERROR is:


** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘Matrix’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package 
1 error x | 0 warnings ? | 0 notes ?
Error: R CMD check found ERRORs
Execution halted

and when:

$ R CMD check pkgname*.tar.gz

It is all good and passes the check.

For the Error, I almost tried every possible solution from the web like 1, 2, 3, 4, 5, 6 and some more, but didn't succeed.

sessionInfo()

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.1 LTS

Matrix products: default
BLAS:   /opt/microsoft/ropen/4.0.2/lib64/R/lib/libRblas.so
LAPACK: /opt/microsoft/ropen/4.0.2/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] eumap_0.0.4          RevoUtils_11.0.2     RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5             paradox_0.7.0          lattice_0.20-41       
 [4] listenv_0.8.0          prettyunits_1.1.1      ps_1.5.0              
 [7] assertthat_0.2.1       rprojroot_1.3-2        digest_0.6.25         
[10] R6_2.4.1               ranger_0.12.1          backports_1.1.8       
[13] ggplot2_3.3.2          pillar_1.4.6           rlang_0.4.10.9000     
[16] uuid_0.1-4             rstudioapi_0.11        data.table_1.12.8     
[19] whisker_0.4            callr_3.5.1            raster_3.3-7          
[22] Matrix_1.2-18          checkmate_2.0.0        mlr3spatiotempcv_0.1.1
[25] devtools_2.3.0         desc_1.2.0             stringr_1.4.0         
[28] munsell_0.5.0          compiler_4.0.2         xfun_0.15             
[31] pkgconfig_2.0.3        pkgbuild_1.1.0         globals_0.12.5        
[34] tidyselect_1.1.0       tibble_3.0.3           lgr_0.3.4             
[37] roxygen2_7.1.1         mlr3misc_0.7.0         codetools_0.2-16      
[40] fansi_0.4.1            future_1.18.0          crayon_1.3.4          
[43] dplyr_1.0.0            withr_2.4.0            commonmark_1.7        
[46] grid_4.0.2             gtable_0.3.0           lifecycle_0.2.0       
[49] git2r_0.27.1           magrittr_2.0.1         scales_1.1.1          
[52] cli_2.2.0              stringi_1.4.6          remotes_2.2.0         
[55] fs_1.5.0               sp_1.4-5               testthat_3.0.1        
[58] xml2_1.3.2             ellipsis_0.3.1         vctrs_0.3.2           
[61] generics_0.0.2         rcmdcheck_1.3.3        tools_4.0.2           
[64] mlr3_0.10.0            glue_1.4.1             purrr_0.3.4           
[67] processx_3.4.5         pkgload_1.1.0          parallel_4.0.2        
[70] colorspace_1.4-1       terra_0.7-11           xopen_1.0.0           
[73] sessioninfo_1.1.1      memoise_1.1.0          knitr_1.29            
[76] usethis_1.6.1  

And I am running on Ubuntu 20.4.

Please help me here.

question from:https://stackoverflow.com/questions/65893303/devtoolscheck-no-package-called-matrix

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem is finally solved. A workflow of my steps is as following:

1- I tried the first approach of @r2evans but it didn't work,

2- According to the solution from @r2evans, @user2554330 , and @pat-s I removed the Microsoft-R,

3- I installed R-CRAN_4.3, R at this stage works on a default BLAS and LAPACK. Here is the output when using the default BLAS/LAPACK libraries on linux:

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

however, to take advantage of the hardware and do multi-thread processing that had to be changed. There are several highly optimized libraries that can be used instead of the default base libraries. I mainly used THIS very interesting and easy to understand/implement approach from Dirk Eddelbuettel. Thus, I did step 4 as:

4- install MKL for .deb-based systems and integrated MKL,

5- removed all the previously installed packages,

6- reinstall all the dependencies and suggested libs mentioned in R-package/Description,

7- run R CMD CHECK --as-CRAN and finally DONE!.

Note: If you (like me) don't know what the BLAS is, HERE is a very cool post about it. Other sources that I used are : 1, 2, and 3.

And thank you all for the comments and advice. @r2evans, @user2554330 , @pat-s


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...