Unable to load certain packages (image not found error)


I'm having trouble loading lme4 (as well as some other packages such as glmmTMB, all with the same error messages). The error message is as below,

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

My sessionInfo() is as below as well,

R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.3

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

[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

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

other attached packages:
[1] Matrix_1.2-18

loaded via a namespace (and not attached):
[1] compiler_3.6.2  tools_3.6.2     splines_3.6.2   grid_3.6.2      packrat_0.5.0   lattice_0.20-40

It was all working fine and then all of sudden this happened, I'm not even sure why or how. Would really appreciate any help!

Your are missing a package dependency, try installing it first


Thank you for the prompt reply @andresrcs. I did that and then got this error.

Error: package or namespace load failed for ‘lme4’ in get(method, envir = envir):
lazy-load database '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/statmod/R/statmod.rdb' is corrupt
In addition: Warning message:
In get(method, envir = envir) : internal error -3 in R_decompress1

However, after restarting R the error disappeared and the packages loaded correctly. While solved, would it be possible to share some insight about how this occurred out of the blue? Thank you :slight_smile:

Sorry I don't have a sure answer for you, but if I would have to guess, I would say that I it's a side effect of some other update process.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.