pharmaR / riskassessment

Risk Assessment Demo App: https://rinpharma.shinyapps.io/riskassessment
https://pharmar.github.io/riskassessment/
Other
98 stars 25 forks source link

Issues restoring R environment #706

Closed LDSamson closed 5 months ago

LDSamson commented 7 months ago

Probably related to #690: I tried to install the latest version of the package on my local computer and restor the R environment (renv::restore()) but encountered several errors, see below. Could it be that some package versions in the snapshot are not compatible with each other?

I saw that in the latest commit to the renv lock file, the posit packagemanagar URL was removed and replaced with the standard CRAN URL. I havent tested it yet, but maybe the problem can be solved if the URL is restored and updated to the latest date needed for the package to function?

pgload error summary ``` Error: Error installing package 'pkgload': =================================== * installing *source* package 'pkgload' ... ** package 'pkgload' successfully unpacked and MD5 sums checked ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location Error: package or namespace load failed for 'pkgload': .onLoad failed in loadNamespace() for 'pkgload', details: call: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) error: namespace 'rlang' 1.0.6 is already loaded, but >= 1.1.1 is required Error: loading failed Execution halted ERROR: loading failed * removing '***/riskassessment/renv/staging/1/pkgload' install of package 'pkgload' failed [error code 1] ```

I also encountered the following error when trying to restore the MASS package version:

MASS package installation error ``` Error: Error installing package 'MASS': ================================ * installing *source* package 'MASS' ... ** package 'MASS' successfully unpacked and MD5 sums checked ** using staged installation ** libs using C compiler: 'gcc.exe (GCC) 12.2.0' gcc -I"*******************/Programs/R/R-43~1.1/include" -DNDEBUG -I"C:/RBuildTools/4.3/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c MASS.c -o MASS.o MASS.c:37:23: error: unknown type name 'Sint'; did you mean 'int'? 37 | VR_sammon(double *dd, Sint *nn, Sint *kd, double *Y, Sint *niter, | ^~~~ | int MASS.c:37:33: error: unknown type name 'Sint'; did you mean 'int'? 37 | VR_sammon(double *dd, Sint *nn, Sint *kd, double *Y, Sint *niter, | ^~~~ | int MASS.c:37:54: error: unknown type name 'Sint'; did you mean 'int'? 37 | VR_sammon(double *dd, Sint *nn, Sint *kd, double *Y, Sint *niter, | ^~~~ | int MASS.c:38:27: error: unknown type name 'Sint'; did you mean 'int'? 38 | double *stress, Sint *trace, double *aa, double *tol) | ^~~~ | int MASS.c:168:8: error: unknown type name 'Sint' 168 | static Sint *ord; /* ranks of dissimilarities */ | ^~~~ MASS.c:169:8: error: unknown type name 'Sint' 169 | static Sint *ord2; /* inverse ordering (which one is rank i?) */ | ^~~~ MASS.c:170:8: error: unknown type name 'Sint' 170 | static Sint n; /* number of dissimilarities */ | ^~~~ MASS.c:171:8: error: unknown type name 'Sint' 171 | static Sint nr; /* number of data points */ | ^~~~ MASS.c:172:8: error: unknown type name 'Sint' 172 | static Sint nc; /* # cols of fitted configuration */ | ^~~~ MASS.c:181:31: error: unknown type name 'Sint'; did you mean 'int'? 181 | VR_mds_fn(double *, double *, Sint *, double *, Sint *, | ^~~~ | int MASS.c:181:49: error: unknown type name 'Sint'; did you mean 'int'? 181 | VR_mds_fn(double *, double *, Sint *, double *, Sint *, | ^~~~ | int MASS.c:182:21: error: unknown type name 'Sint'; did you mean 'int'? 182 | double *, Sint *, Sint *, double *, Sint *, double *); | ^~~~ | int MASS.c:182:29: error: unknown type name 'Sint'; did you mean 'int'? 182 | double *, Sint *, Sint *, double *, Sint *, double *); | ^~~~ | int MASS.c:182:47: error: unknown type name 'Sint'; did you mean 'int'? 182 | double *, Sint *, Sint *, double *, Sint *, double *); | ^~~~ | int MASS.c:188:18: error: unknown type name 'Sint'; did you mean 'int'? 188 | VR_mds_init_data(Sint *pn, Sint *pc, Sint *pr, Sint *orde, | ^~~~ | int MASS.c:188:28: error: unknown type name 'Sint'; did you mean 'int'? 188 | VR_mds_init_data(Sint *pn, Sint *pc, Sint *pr, Sint *orde, | ^~~~ | int MASS.c:188:38: error: unknown type name 'Sint'; did you mean 'int'? 188 | VR_mds_init_data(Sint *pn, Sint *pc, Sint *pr, Sint *orde, | ^~~~ | int MASS.c:188:48: error: unknown type name 'Sint'; did you mean 'int'? 188 | VR_mds_init_data(Sint *pn, Sint *pc, Sint *pr, Sint *orde, | ^~~~ | int MASS.c:189:18: error: unknown type name 'Sint'; did you mean 'int'? 189 | Sint *ordee, double *xx, double *p) | ^~~~ | int MASS.c: In function 'fminfn': MASS.c:240:5: error: unknown type name 'Sint'; did you mean 'int'? 240 | Sint do_derivatives = 0; | ^~~~ | int MASS.c:243:5: warning: implicit declaration of function 'VR_mds_fn'; did you mean 'VR_mds_unload'? [-Wimplicit-function-declaration] 243 | VR_mds_fn(y, yf, &n, &ssq, ord2, x, &nr, &nc, 0, &do_derivatives, | ^~~~~~~~~ | VR_mds_unload MASS.c: In function 'fmingr': MASS.c:252:5: error: unknown type name 'Sint'; did you mean 'int'? 252 | Sint do_derivatives = 1; | ^~~~ | int MASS.c: At top level: MASS.c:263:26: error: unknown type name 'Sint'; did you mean 'int'? 263 | VR_mds_dovm(double *val, Sint *maxit, Sint *trace, double *xx, double *tol) | ^~~~ | int MASS.c:263:39: error: unknown type name 'Sint'; did you mean 'int'? 263 | VR_mds_dovm(double *val, Sint *maxit, Sint *trace, double *xx, double *tol) | ^~~~ | int MASS.c:280:34: error: unknown type name 'Sint'; did you mean 'int'? 280 | VR_mds_fn(double *y, double *yf, Sint *pn, double *pssq, Sint *pd, | ^~~~ | int MASS.c:280:58: error: unknown type name 'Sint'; did you mean 'int'? 280 | VR_mds_fn(double *y, double *yf, Sint *pn, double *pssq, Sint *pd, | ^~~~ | int MASS.c:281:22: error: unknown type name 'Sint'; did you mean 'int'? 281 | double *x, Sint *pr, Sint *pncol, double *der, | ^~~~ | int MASS.c:281:32: error: unknown type name 'Sint'; did you mean 'int'? 281 | double *x, Sint *pr, Sint *pncol, double *der, | ^~~~ | int MASS.c:282:11: error: unknown type name 'Sint'; did you mean 'int'? 282 | Sint *do_derivatives, double *p) | ^~~~ | int MASS.c:356:12: error: unknown type name 'Sint'; did you mean 'int'? 356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:356:21: error: unknown type name 'Sint'; did you mean 'int'? 356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:356:31: error: unknown type name 'Sfloat'; did you mean 'float'? 356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:356:42: error: unknown type name 'Sint'; did you mean 'int'? 356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:356:51: error: unknown type name 'Sfloat'; did you mean 'float'? 356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:356:62: error: unknown type name 'Sfloat'; did you mean 'float'? 356 | VR_ucv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:373:12: error: unknown type name 'Sint'; did you mean 'int'? 373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:373:21: error: unknown type name 'Sint'; did you mean 'int'? 373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:373:31: error: unknown type name 'Sfloat'; did you mean 'float'? 373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:373:42: error: unknown type name 'Sint'; did you mean 'int'? 373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:373:51: error: unknown type name 'Sfloat'; did you mean 'float'? 373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:373:62: error: unknown type name 'Sfloat'; did you mean 'float'? 373 | VR_bcv_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:391:13: error: unknown type name 'Sint'; did you mean 'int'? 391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:391:22: error: unknown type name 'Sint'; did you mean 'int'? 391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:391:32: error: unknown type name 'Sfloat'; did you mean 'float'? 391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:391:43: error: unknown type name 'Sint'; did you mean 'int'? 391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:391:52: error: unknown type name 'Sfloat'; did you mean 'float'? 391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:391:63: error: unknown type name 'Sfloat'; did you mean 'float'? 391 | VR_phi4_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:409:13: error: unknown type name 'Sint'; did you mean 'int'? 409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:409:22: error: unknown type name 'Sint'; did you mean 'int'? 409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:409:32: error: unknown type name 'Sfloat'; did you mean 'float'? 409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:409:43: error: unknown type name 'Sint'; did you mean 'int'? 409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~ | int MASS.c:409:52: error: unknown type name 'Sfloat'; did you mean 'float'? 409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:409:63: error: unknown type name 'Sfloat'; did you mean 'float'? 409 | VR_phi6_bin(Sint *n, Sint *nb, Sfloat *d, Sint *x, Sfloat *h, Sfloat *u) | ^~~~~~ | float MASS.c:428:12: error: unknown type name 'Sint'; did you mean 'int'? 428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt) | ^~~~ | int MASS.c:428:21: error: unknown type name 'Sint'; did you mean 'int'? 428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt) | ^~~~ | int MASS.c:428:31: error: unknown type name 'Sfloat'; did you mean 'float'? 428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt) | ^~~~~~ | float MASS.c:428:42: error: unknown type name 'Sfloat'; did you mean 'float'? 428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt) | ^~~~~~ | float MASS.c:428:53: error: unknown type name 'Sint'; did you mean 'int'? 428 | VR_den_bin(Sint *n, Sint *nb, Sfloat *d, Sfloat *x, Sint *cnt) | ^~~~ | int MASS.c:466:31: error: 'VR_bcv_bin' undeclared here (not in a function) 466 | {"VR_bcv_bin", (DL_FUNC) &VR_bcv_bin, 6}, | ^~~~~~~~~~ MASS.c:467:31: error: 'VR_den_bin' undeclared here (not in a function) 467 | {"VR_den_bin", (DL_FUNC) &VR_den_bin, 5}, | ^~~~~~~~~~ MASS.c:468:32: error: 'VR_mds_dovm' undeclared here (not in a function); did you mean 'VR_mds_unload'? 468 | {"VR_mds_dovm", (DL_FUNC) &VR_mds_dovm, 5}, | ^~~~~~~~~~~ | VR_mds_unload MASS.c:469:30: error: 'VR_mds_fn' undeclared here (not in a function); did you mean 'VR_mds_unload'? 469 | {"VR_mds_fn", (DL_FUNC) &VR_mds_fn, 11}, | ^~~~~~~~~ | VR_mds_unload MASS.c:470:37: error: 'VR_mds_init_data' undeclared here (not in a function) 470 | {"VR_mds_init_data", (DL_FUNC) &VR_mds_init_data, 7}, | ^~~~~~~~~~~~~~~~ MASS.c:472:32: error: 'VR_phi4_bin' undeclared here (not in a function) 472 | {"VR_phi4_bin", (DL_FUNC) &VR_phi4_bin, 6}, | ^~~~~~~~~~~ MASS.c:473:32: error: 'VR_phi6_bin' undeclared here (not in a function) 473 | {"VR_phi6_bin", (DL_FUNC) &VR_phi6_bin, 6}, | ^~~~~~~~~~~ MASS.c:474:30: error: 'VR_sammon' undeclared here (not in a function) 474 | {"VR_sammon", (DL_FUNC) &VR_sammon, 9}, | ^~~~~~~~~ MASS.c:475:31: error: 'VR_ucv_bin' undeclared here (not in a function) 475 | {"VR_ucv_bin", (DL_FUNC) &VR_ucv_bin, 6}, | ^~~~~~~~~~ MASS.c:249:1: warning: 'fmingr' defined but not used [-Wunused-function] 249 | fmingr(int nn, double *x, double *der, void *dummy) | ^~~~~~ MASS.c:237:1: warning: 'fminfn' defined but not used [-Wunused-function] 237 | fminfn(int nn, double *x, void *dummy) | ^~~~~~ MASS.c:173:12: warning: 'dimx' defined but not used [-Wunused-variable] 173 | static int dimx; /* Size of configuration array */ | ^~~~ ```

Session Info:

Session Info ``` R version 4.3.1 (2023-06-16 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22621) Matrix products: default locale: [1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C [5] LC_TIME=German_Germany.utf8 time zone: Europe/Berlin tzcode source: internal attached base packages: [1] stats graphics grDevices datasets utils methods base loaded via a namespace (and not attached): [1] compiler_4.3.1 BiocManager_1.30.22 tools_4.3.1 renv_1.0.0 ```
LDSamson commented 7 months ago

Furthermore, just some thoughts although I am not an expert on this: I expect that by using the posit packagemanager at an adequate fixed time point, it will speed up installation of packages since less packages need to be compiled from source using Rtools?

LDSamson commented 7 months ago

Update: for me, renv::restore() works after applying the following changes to the renv.lock file:

After these changes, the app starts but now shows an error after uploading the package dplyr when reviewing the maintenance metrics:

image

Error message ``` {"timestamp": "2023-11-27T16:39:38+0100", "log_lvl": "INFO", "log_msg": "User ADMIN signed on as admin"} Warning: Error in mtfrm.default: cannot mtfrm 103: stop 102: mtfrm.default 100: %in% 99: renderUI [~path_to_package/R/mod_metricBox.R#80] 98: func [*path_to_appdata/Local/Temp/RtmpmSUlh9/R.INSTALL9364771a254a/shiny/R/utils.R#1451] 85: renderFunc [*path_to_appdata/Local/Temp/RtmpmSUlh9/R.INSTALL9364771a254a/shiny/R/shinywrappers.R#263] 84: output$maintenanceMetrics-metricGrid-has_website-metricBox_ui [*path_to_appdata/Local/Temp/RtmpmSUlh9/R.INSTALL9364771a254a/shiny/R/shinywrappers.R#133] 3: runApp [*path_to_appdata/Local/Temp/RtmpmSUlh9/R.INSTALL9364771a254a/shiny/R/runapp.R#388] 2: print.shiny.appobj [*path_to_appdata/Local/Temp/RtmpmSUlh9/R.INSTALL9364771a254a/shiny/R/shinyapp.R#553] 1: ```
LDSamson commented 5 months ago

Issue above resolved by downgrading R version to 4.2.2. Note that the error mentioned above might occur again if later package dependency versions will be used in a future version of the application.