Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

I have uploaded the version of R to 4.0.2 (2020-06-22). After installing the gmm package when I require it I got the message below. I have also taken this message for the other packages like TropFishR. I have Xcode 10.3 . I reinstalled R studio and R several times. 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
like image 713
pomatomus Avatar asked Sep 19 '25 14:09

pomatomus


2 Answers

The problem is caused because Library not loaded: /usr/local/gfortran/lib/libgomp.1.dylib is missed.

To solve it, I went to this Github release page, downloaded gfortran-10.2-Catalina.dmg, and installed it. Then I can finally load gmm package in R.

like image 97
user14675774 Avatar answered Sep 21 '25 06:09

user14675774


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, e.g., using the following command:

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

maybe the directory /gfortran/lib is required to be built manually. Hope helpful~

like image 30
Minux Avatar answered Sep 21 '25 04:09

Minux