服务器的R4.2.1装不上ggpubr包解决办法

服务器 0

问题:服务器版RStudio server安装R包ggpubr,总是提示失败。
install.packages("ggpubr")
BiocManager::install('ggpubr')
devtools::install_github("kassambara/ggpubr")
以上安装方法都不成功,提示:
......
gcc -std=gnu11 -shared -L/opt/R/4.2.1/lib/R/lib -L/usr/local/lib -o Matrix.so Csparse.o abIndex.o attrib.o bind.o chm_common.o cholmod-etc.o coerce.o cs.o cs-etc.o dense.o determinant.o dgCMatrix.o dgeMatrix.o factorizations.o idz.o init.o kappa.o objects.o perm.o products.o solve.o sparse.o sparseVector.o subscript.o utils-R.o utils.o validity.o CHOLMOD.a COLAMD.a AMD.a SuiteSparse_config.a -L/opt/R/4.2.1/lib/R/lib -lRlapack -L/opt/R/4.2.1/lib/R/lib -lRblas -lgfortran -lm -lquadmath -L/opt/R/4.2.1/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [/opt/R/4.2.1/lib/R/share/make/shlib.mk:10: Matrix.so] Error 1
ERROR: compilation failed for package ‘Matrix’
* removing ‘/home/yang_jg/R/x86_64-pc-linux-gnu-library/4.2/Matrix’
* installing *source* package ‘SparseM’ ...
** package ‘SparseM’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
......
gcc -std=gnu11 -shared -L/opt/R/4.2.1/lib/R/lib -L/usr/local/lib -o SparseM.so bckslv.o chol.o chol2csr.o cholesky.o csr.o extract.o init.o sparskit.o subscr.o -lgfortran -lm -lquadmath -L/opt/R/4.2.1/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [/opt/R/4.2.1/lib/R/share/make/shlib.mk:10: SparseM.so] Error 1
ERROR: compilation failed for package ‘SparseM’
* removing ‘/home/yang_jg/R/x86_64-pc-linux-gnu-library/4.2/SparseM’
* installing *source* package ‘MatrixModels’ ...
** package ‘MatrixModels’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace ‘Matrix’ 1.4-1 is being loaded, but >= 1.6.0 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package ‘MatrixModels’
* removing ‘/home/yang_jg/R/x86_64-pc-linux-gnu-library/4.2/MatrixModels’
ERROR: dependencies ‘SparseM’, ‘MatrixModels’ are not available for package ‘quantreg’
* removing ‘/home/yang_jg/R/x86_64-pc-linux-gnu-library/4.2/quantreg’
ERROR: dependency ‘quantreg’ is not available for package ‘car’
* removing ‘/home/yang_jg/R/x86_64-pc-linux-gnu-library/4.2/car’
ERROR: dependency ‘car’ is not available for package ‘rstatix’
* removing ‘/home/yang_jg/R/x86_64-pc-linux-gnu-library/4.2/rstatix’
ERROR: dependency ‘rstatix’ is not available for package ‘ggpubr’
* removing ‘/home/yang_jg/R/x86_64-pc-linux-gnu-library/4.2/ggpubr’

解决办法:
服务器启动jupyter notebook ,然后使用R4.0.0新建notebook(新建一个xx.ipynb的文件),在里面安装软件包:
备注:jupyter notebook更新R版本请参考:https://cloud.tencent.com/developer/ask/sof/1539811
install.packages("ggplot2")
install.packages("ggpubr") #安装ggpubr和其它的依赖包
library(ggpubr)  #可以正常加载ggpubr包

然后在服务器版RStudio server也可以加载ggpubr包。
偶然发现的,经验总结,2023.12.5

也许您对下面的内容还感兴趣: