Error when loading new package (image not found)

Hi there,

I recently have troubles loading new packages that I have installed. For example: I installed the package haven, but when using the library(haven) command I always get the following message:

library(haven)
Fehler: Laden von Paket oder Namensraum für ‘haven’ in dyn.load(file, DLLpath = DLLpath, ...): fehlgeschlagen
kann shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/vctrs/libs/vctrs.so' nicht laden:
dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/vctrs/libs/vctrs.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/vctrs/libs/vctrs.so
Reason: image not found

Here is what I already tried:

  1. deinstall and install R and R studio
  2. install package via this command install.packages("haven", type="binary")
  3. install package via this command install.packages("haven", repo = 'https://mac.R-project.org')

can somebody please help?

The installed package vctrs seems to have been compiled against R 4.0 but installed with R 4.2. That is why it cannot load /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib.

I would try and reinstall at least vctrs as before and see if that works. haven or the RStudio version is definitely not the real problem.

PS: I am on M1 Mac and juts upgraded Rstudio and added R 4.2.0 and everything seems to work when installing haven.

Hi Michael,

I ran the following:
install.packages("vctrs")
library(vctrs)

My output however again shows an error after loafing the package:

library(vctrs)
Fehler: Laden von Paket oder Namensraum für ‘vctrs’ in get(Info[i, 1], envir = env): fehlgeschlagen
lazy-load database '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/vctrs/R/vctrs.rdb' is corrupt
Zusätzlich: Warnmeldung:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1

I just checked my library on my old R 4.0 and it is completely empty, R 4.2 has all the package though

I wonder if we could just do the following:

  • Uninstall R 4.2 (and 4.0 if not uninstalled yet)
  • Make sure that Folder /Library/Frameworks/R.framework/Versions/4.2/ (and /Library/Frameworks/R.framework/Versions/4.0/ if you uninstalled R 4.0) is completely empty (any files left after 4.2/4.0 uninstall, please delete`
  • Install 4.2 again.

Let's see if that solves the issue.

Thanks! its working now, i updated vctrs and used this code update.packages(checkBuilt=TRUE)

1 Like

This topic was automatically closed 7 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.