[英]devtools::check() - no package called ‘Matrix’
I want to prepare my first package for CRAN, and continuously facing this error我想为 CRAN 准备我的第一个 package,并不断面临这个错误
when in Rstudio:在 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.对于错误,我几乎尝试了 web 中的所有可能解决方案,例如1 、 2 、 3 、 4 、 5 、 6等等,但没有成功。
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.我在 Ubuntu 20.4 上运行。
Please help me here.请在这里帮助我。
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, 1-我尝试了@r2evans的第一种方法,但没有奏效,
2- According to the solution from @r2evans, @user2554330, and @pat-s I removed the Microsoft-R , 2- 根据@r2evans、@user2554330 和@pat-s 的解决方案,我删除了 Microsoft-R ,
3- I installed R-CRAN_4.3 , R at this stage works on a default BLAS and LAPACK . 3-我在这个阶段安装了 R-CRAN_4.3 , R 工作在默认的BLAS和LAPACK上。 Here is the output when using the default BLAS/LAPACK libraries on linux:
这是在 linux 上使用默认 BLAS/LAPACK 库时的 output:
## 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 .
我主要使用Dirk Eddelbuettel的这个非常有趣且易于理解/实现的方法。 Thus, I did step 4 as:
因此,我将第 4 步执行为:
4- install MKL for.deb-based systems and integrated MKL , 4-安装 MKL for.deb-based 系统和集成 MKL ,
5- removed all the previously installed packages, 5-删除所有以前安装的软件包,
6- reinstall all the dependencies and suggested libs mentioned in R-package/Description
, 6-重新安装
R-package/Description
中提到的所有依赖项和建议的库,
7- run R CMD CHECK --as-CRAN and finally DONE! 7-运行R CMD CHECK --as-CRAN ,最后完成! .
.
Note: If you (like me) don't know what the BLAS is, HERE is a very cool post about it.注意:如果你(像我一样)不知道 BLAS 是什么, 这里有一篇非常酷的帖子。 Other sources that I used are: 1 , 2 , and 3 .
我使用的其他来源是: 1 、 2和3 。
And thank you all for the comments and advice.并感谢大家的意见和建议。 @r2evans, @user2554330, @pat-s
@r2evans,@user2554330,@pat-s
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.