haven appears to install but won't load; tidyverse won't load if haven is installed

When I try to install haven it appears to be successful:

> install.packages("haven")
Installing package into ‘/Users/rclement/Library/R/4.0/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/haven_2.3.1.tgz'
Content type 'application/x-gzip' length 1131774 bytes (1.1 MB)
==================================================
downloaded 1.1 MB


The downloaded binary packages are in
	/var/folders/0_/312zhl05769fhjsc3m7ysbk00000gp/T//RtmpSjGJEq/downloaded_packages

However, after I have done this, haven will not load:

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

At the same time, tidyverse will no longer load if haven is "installed":

> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/rclement/Library/R/4.0/library/haven/libs/haven.so':
  dlopen(/Users/rclement/Library/R/4.0/library/haven/libs/haven.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib
  Referenced from: /Users/rclement/Library/R/4.0/library/haven/libs/haven.so
  Reason: image not found
In addition: Warning message:
replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’ 

If I remove haven though, tidyverse loads normally. I need haven and tidyverse both to run someone else's code, so I need to figure out what is going on. Looking through the forums here and on Stack Exchange hasn't given me any clues, as most posts I find are just about not being able to install or load either tidyverse OR haven and not this particular trouble.

is it possible you are using R with Anaconda ?
Loading Path Library Path Issue (I think)? - General - RStudio Community

Nope, that's not the issue. I don't even have Anaconda installed on this machine. Thanks though!

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.