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.