Cannot load some installed packages in RStudio

Hi,

I just installed keras and reticulate packages in RStudio, but cannot load them through library(). Some other packages can be loaded. I updated my R version to 4.2 and manually copied all the packages into the new version library, then updated the packages. keras and reticulate packages are installed after this update is completed, but the error message mentions that this may be related to the previous R version (4.1). The error is as below:

# Load the packages
library(reticulate)
library(keras)

# Error message
Error: package or namespace load failed for ‘reticulate’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/png/libs/png.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/png/libs/png.so, 0x0006): Library not loaded: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libR.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/png/libs/png.so
  Reason: tried: '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libR.dylib' (no such file), '/usr/lib/libR.dylib' (no such file)

Error: package or namespace load failed for ‘keras’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/png/libs/png.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/png/libs/png.so, 0x0006): Library not loaded: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libR.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/png/libs/png.so
  Reason: tried: '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libR.dylib' (no such file), '/usr/lib/libR.dylib' (no such file)

Can anyone give me some help?

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.