由于 MatrixModels 软件包存在问题,安装 rms 软件包时出现问题

问题描述 投票:0回答:1

在我的 Mac 上。我已经在 R 中安装了 rms 包。当尝试加载该包时,我收到以下错误消息:

library(rms)

错误:loadNamespace 中的“rms”包或命名空间加载失败(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘MatrixModels’

然后我尝试:

install.packages("MatrixModels")

这会生成一个非常长的输出,最后是:

/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../AMD.a(amd_i_dump.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: ../../AMD.a(amd_l_dump.o) has no symbols
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DNTIMER  -I/usr/local/include   -fPIC  -Wall -g -O2  -c SuiteSparse_config.c -o SuiteSparse_config.o
ar -rucs ../SuiteSparse_config.a SuiteSparse_config.o
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Matrix.so CHMfactor.o Csparse.o init.o Mutils.o bind.o chm_common.o coerce.o cs.o cs_utils.o dense.o dgCMatrix.o dgeMatrix.o factorizations.o kappa.o sparseVector.o abIndex.o packedMatrix.o products.o unpackedMatrix.o sparse.o subscript.o validity.o CHOLMOD.a COLAMD.a AMD.a SuiteSparse_config.a -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Matrix.so] Error 1
ERROR: compilation failed for package ‘Matrix’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Matrix’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Matrix’
Warning in install.packages :
  installation of package ‘Matrix’ had non-zero exit status
* 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.5-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 ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/MatrixModels’
Warning in install.packages :
  installation of package ‘MatrixModels’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/50/kh0h3dds7hzdmnbcdypxrtb80000gq/T/RtmpW5Hzvm/downloaded_packages’

如果我随后尝试安装 Matrix,这也不起作用:

> install.packages("Matrix")
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Matrix.so] Error 1
ERROR: compilation failed for package ‘Matrix’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Matrix’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Matrix’
Warning in install.packages :
  installation of package ‘Matrix’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/50/kh0h3dds7hzdmnbcdypxrtb80000gq/T/RtmpxdA2VZ/downloaded_packages’

我不知道如何尝试在这里排除故障,因此我问。有没有人遇到过类似的问题,如果有的话,找到了解决方案吗?可以说,我正在一台工作计算机上工作,我没有完全的管理员权限(但我设法安装和加载我需要的所有其他软件包)。

r macos install.packages
1个回答
0
投票

评论部分指出的解决方案是:

install.packages(c("Matrix", "MatrixModels", "mvtnorm"), type = "binary")
install.packages("rms")
library(rms)
© www.soinside.com 2019 - 2024. All rights reserved.