简体   繁体   English

错误:package 或 dyn.load(文件,DLLpath = DLLpath,...)中的“gmm”的命名空间加载失败:无法加载共享 object

[英]Error: package or namespace load failed for ‘gmm’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object

I have uploaded the version of R to 4.0.2 (2020-06-22).我已经上传了R的版本到4.0.2(2020-06-22)。 After installing the gmm package when I require it I got the message below.在我需要安装 gmm package 后,我收到了以下消息。 I have also taken this message for the other packages like TropFishR.我还为其他软件包(如 TropFishR)获取了此消息。 I have Xcode 10.3.我有 Xcode 10.3。 I reinstalled R studio and R several times.我重新安装了 R studio 和 R 几次。 thank you very much for your time.非常感谢您的宝贵时间。

Error message:错误信息:

Error: package or namespace load failed for ‘gmm’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so, 6): Library not loaded: /usr/local/gfortran/lib/libgomp.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so
  Reason: image not found


session info:

 version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils    
[5] datasets  methods   base     

other attached packages:
[1] sandwich_2.5-1

loaded via a namespace (and not attached):
[1] zoo_1.8-8       compiler_4.0.2 
[3] tools_4.0.2     grid_4.0.2     
[5] lattice_0.20-41

The problem is caused because Library not loaded: /usr/local/gfortran/lib/libgomp.1.dylib is missed.该问题是由于Library not loaded: /usr/local/gfortran/lib/libgomp.1.dylib丢失。

To solve it, I went to this Github release page, downloaded gfortran-10.2-Catalina.dmg , and installed it.为了解决这个问题,我去了这个Github 发布页面,下载gfortran-10.2-Catalina.dmg并安装了它。 Then I can finally load gmm package in R.然后我终于可以在R中加载gmm package。

On MacOS 13, download this file , and build a hard link to /usr/local/gfortran/lib/libgomp.1.dylib in /opt/R/arm64/gfortran/lib , eg, using the following command:在 MacOS 13 上,下载此文件,并在/opt/R/arm64/gfortran/lib中构建到/usr/local/gfortran/lib/libgomp.1.dylib的硬链接,例如,使用以下命令:

sudo ln libgomp.1.dylib /opt/R/arm64/gfortran/lib/libgomp.1.dylib 

maybe the directory /gfortran/lib is required to be built manually.也许目录/gfortran/lib需要手动构建。 Hope helpful~希望有帮助~

Using this answer I found a (temporary) way to fix this issue without messing around with installations.使用这个答案,我找到了一种(临时)方法来解决这个问题,而不会弄乱安装。

Finding the file查找文件

It seems that the program can't find libgomp.1.dylib , however, your system may already have this file installed.该程序似乎找不到libgomp.1.dylib ,但是,您的系统可能已经安装了此文件。 Using使用

locate libgomp.1.dylib

you get a list of places where this library has been found.你会得到一个找到这个图书馆的地方的列表。 If you are running this command for the first time, you may have to run another command first to create the index.如果您是第一次运行此命令,您可能必须先运行另一个命令来创建索引。

For me, this was对我来说,这是

/usr/local/Cellar/gcc/12.1.0/lib/gcc/current/libgomp.1.dylib

however, it might be different on your system.但是,在您的系统上可能会有所不同。

If nothing is returned, you may need to install gfortran on your system, eg using brew install gcc .如果没有返回,您可能需要在系统上安装gfortran ,例如使用brew install gcc

Linking the file链接文件

My error message showed me some places where it tried to look for the file, one of which was in my user directory:我的错误消息向我显示了它试图查找文件的一些地方,其中一个在我的用户目录中:

/Users/overground/lib

so, using ln , create a link from this directory to the file you have found in the previous step.因此,使用ln创建从该目录到您在上一步中找到的文件的链接 First, ensure that the lib folder exists in your user directory.首先,确保lib文件夹存在于您的用户目录中。 Then, link the files with然后,将文件与

ln /usr/local/Cellar/gcc/12.1.0/lib/gcc/current/libgomp.1.dylib /Users/overground/lib

Replace the first file path with the file path you have found in the first step, and the username in the second path.将第一个文件路径替换为您在第一步中找到的文件路径,以及第二个路径中的用户名。 Now, you should be able to see the file in the lib directory.现在,您应该能够在lib目录中看到该文件。

I hope this helps!我希望这有帮助!

This would sound crazy, but I had the same problem running a bash script (say masterPipeline.sh) that I wrote.这听起来很疯狂,但我在运行我编写的 bash 脚本(比如 masterPipeline.sh)时遇到了同样的问题。 When I wrote that script it was working fine, however a couple of days ago I got this error:当我编写该脚本时它工作正常,但是几天前我收到此错误:

Error: package or namespace load failed for ‘stats’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/hemiptero/lib/R/library/stats/libs/stats.so':

The issue came after masterPipeline.sh invoke R to make a subroutine (R <./scripts/measure2sd.r --no-save) but when I type that command by myself in the terminal I don't get the error.问题是在 masterPipeline.sh 调用 R 来创建子例程 (R <./scripts/measure2sd.r --no-save) 之后出现的,但是当我自己在终端中键入该命令时,我没有收到错误。

So, I don't know how but I get with the idea of running my script as superuser.所以,我不知道如何,但我想到了以超级用户身份运行我的脚本。

sudo masterPipeline.sh   

It works!有用!

So maybe running R as superuser would works for those working on linux所以也许以超级用户身份运行 R 对那些在 linux 上工作的人有用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 R:库错误(affy):错误:package 或 dyn.load(文件,DLLpath = DLLpath,...)中“affy”的命名空间加载失败:无法加载共享对象 - R: Error in library(affy): Error: package or namespace load failed for ‘affy’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared objec 安装 stringr、stringi “Error: package or namespace load failed for 'stringi' in dyn.load(file, DLLpath = DLLpath, ...)”和共享 object 问题 - installing stringr, stringi “Error: package or namespace load failed for ‘stringi’ in dyn.load(file, DLLpath = DLLpath, …)” and shared object issue 在 dyn.load(file, DLLpath = DLLpath, ...) 中安装“magick”时出错:无法加载共享 object - error installing ‘magick’ in dyn.load(file, DLLpath = DLLpath, …): unable to load shared object R:错误安装包UBUNTU - dyn.load中的错误(文件,DLLpath = DLLpath,...):无法加载共享对象 - R: error installing packages UBUNTU - Error in dyn.load(file, DLLpath = DLLpath, …) : unable to load shared object dyn.load中的错误(文件,DLLpath = DLLpath,...) - Error in dyn.load(file, DLLpath = DLLpath, …) 无法安装leaps包,dyn.load中的错误(文件,DLLpath = DLLpath,...)[Mac OSX] - Unable to install leaps package, Error in dyn.load(file, DLLpath = DLLpath, …) [Mac OSX] 使用ggsave时dyn.load(file,DLLpath = DLLpath,...)中的错误 - Error in dyn.load(file, DLLpath = DLLpath, …) when using ggsave R: dyn.load(file, DLLpath = DLLpath, ...) 中的错误 - R: Error in dyn.load(file, DLLpath = DLLpath, …) Gurobi 包无法在 Ubuntu 14.04 中加载,dyn.load(file, DLLpath = DLLpath, ...) 出错: - Gurobi package does not load in Ubuntu 14.04, Error in dyn.load(file, DLLpath = DLLpath, …) : 创建R包时出错:dyn.load中的错误(文件,DLLpath = DLLpath,...) - Error creating R package: Error in dyn.load(file, DLLpath = DLLpath, …)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM