首页 > 解决方案 > 'utils' 的 loadNamespace() 中的 onLoad 失败,详细信息

问题描述

我目前正在构建一个无发行版的R 映像(尽管我不精通 R)

我目前正在从https://cloud.r-project.org/bin/linux/debian/buster-cran35/为 amd64 架构提取 deb 包。

我可以从创建的图像交互地运行 R,但是,一些核心库没有正确加载,并且终端中有关故障原因的信息很少。

以下是运行以下命令的输出:R --verbose

'verbose' and 'quietly' are both true; being verbose then ..
now dyn.load("/usr/lib/R/library/methods/libs/methods.so") ...

R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

'verbose' and 'quietly' are both true; being verbose then ..
'verbose' and 'quietly' are both true; being verbose then ..
now dyn.load("/usr/lib/R/library/utils/libs/utils.so") ...
Garbage collection 1 = 0+0+1 (level 2) ...
12.0 Mbytes of cons cells used (35%)
3.1 Mbytes of vectors used (5%)
Error: package or namespace load failed for 'utils':
 .onLoad failed in loadNamespace() for 'utils', details:
  call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
  error: error in running command
'verbose' and 'quietly' are both true; being verbose then ..
now dyn.load("/usr/lib/R/library/grDevices/libs/grDevices.so") ...
'verbose' and 'quietly' are both true; being verbose then ..
now dyn.load("/usr/lib/R/library/graphics/libs/graphics.so") ...
'verbose' and 'quietly' are both true; being verbose then ..
shared object ''utils.so'' already loaded
Error: package or namespace load failed for 'stats':
 .onLoad failed in loadNamespace() for 'utils', details:
  call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
  error: error in running command

utils.so 的所有依赖库都可以通过 ldd 命令找到。

ldd utils.so 链接命令的输出:

/ # ldd /usr/lib/R/library/utils/libs/utils.so
    linux-vdso.so.1 (0x00007ffe772f9000)
    libR.so => /usr/lib/libR.so (0x00007f127acdf000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f127ab1e000)
    libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 (0x00007f127aac3000)
    libgfortran.so.5 => /usr/lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007f127a855000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f127a6d2000)
    libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f127a690000)
    libreadline.so.7 => /lib/x86_64-linux-gnu/libreadline.so.7 (0x00007f127a441000)
    libpcre2-8.so.0 => /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f127a3bc000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f127a348000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f127a320000)
    libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f127a30d000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f127a0ef000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f127a0e3000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f127a0de000)
    libicuuc.so.63 => /usr/lib/x86_64-linux-gnu/libicuuc.so.63 (0x00007f1279f0f000)
    libicui18n.so.63 => /usr/lib/x86_64-linux-gnu/libicui18n.so.63 (0x00007f1279c34000)
    libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f1279c03000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1279be2000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f127b17f000)
    libopenblas.so.0 => /usr/lib/x86_64-linux-gnu/libopenblas.so.0 (0x00007f12779fc000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f12779e2000)
    libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f12779b4000)
    libicudata.so.63 => /usr/lib/x86_64-linux-gnu/libicudata.so.63 (0x00007f1275fc4000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1275e40000)

我在这里可能缺少什么?

"utils.so" already loaded可能表明什么?

标签: rlinux

解决方案


我认为您缺少“哪个”。

在这个代码块system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)中,which是一个来自的对象Sys.which,它的值是字符串“/usr/bin/which”。

您应该尝试安装which.


推荐阅读