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

I am having trouble loading the tidyverse library. I am new to R. After installing packages using:

install.packages("tidyverse",dependencies = TRUE)

No problem thus far... but then I try to load the tidyverse library:

library(tidyverse)

I get the following:

Error: package or namespace load failed for ‘tidyverse’ in 
dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object 
'/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':

dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so, 6): 
Symbol not found: ___cxa_uncaught_exceptions Referenced from: 
/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib Expected in: 
/usr/lib/libc++abi.dylib in /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib

I have tried installing and uninstalling R, with no effect.

I'm using Version 1.1.463 – © 2009-2018 RStudio, Inc. for use with OS X El Capitan Version 10.11.4

1 Like

If the tidyverse package doesn't load, it probably means it didn't install correctly the first time.

Please rerun the package installation, then pay careful attention to the final output. If you find any errors reported in the console, please post these here, so we can help troubleshoot.

2 Likes

Have you tryed removing and reinstalling Rcpp package?

Hi andrie and andresrcs, thank you very much for your replies!

When I try to remove Rcpp - it says it's not there:

remove.packages("Rcpp","tidyverse")
Error in remove.packages : there is no package called ‘Rcpp’

After which I removed tidyverse, and got the following:

remove.packages("tidyverse")
Removing package from ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library’
(as ‘lib’ is unspecified)

install.packages("Rcpp","tidyverse")
Warning in install.packages :
'lib = "tidyverse"' is not writable
Would you like to use a personal library instead? (yes/No/cancel)

So what should I do next?

1 Like

If you want to install or remove more than one package at a time you have to use a vector, like this.

install.packages(c("Rcpp","tidyverse"))
2 Likes

Awesome, thanks... this time I got:

remove.packages(c("Rcpp", "tidyverse"))
Removing packages from ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library’
(as ‘lib’ is unspecified)

install.packages("Rcpp", "tidyverse")
Warning in install.packages :
'lib = "tidyverse"' is not writable
Would you like to use a personal library instead? (yes/No/cancel)

So should I use a personal library? (I don't really know what that means)... by the way, when I just hit enter after the previous prompt, I get:

Error in install.packages : unable to install packages
Error in install.packages : unable to install packages

You are making exactly the same mistake, if you want to install more than one package at a time you have to use a vector.

install.packages(c("Rcpp","tidyverse"))

Whoops, that was embarassing... sorry for making you repeat yourself.

Ok, so I uninstalled the packages (using the vector), shut down Rstudio, opened it again, installed the packages... and still get the same result. I've cut and paste the process from after I opened Rstudio:

> install.packages(c("Rcpp", "tidyverse"))
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/Rcpp_1.0.2.tgz'
Content type 'application/x-gzip' length 4639720 bytes (4.4 MB)
==================================================
downloaded 4.4 MB

trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/tidyverse_1.2.1.tgz'
Content type 'application/x-gzip' length 89217 bytes (87 KB)
==================================================
downloaded 87 KB


The downloaded binary packages are in
	/var/folders/lt/zdxgfnp15lg_ypzny4_pgdxc0000gn/T//Rtmp4IX6kg/downloaded_packages
> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so, 6): Symbol not found: ___cxa_uncaught_exceptions
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
  Expected in: /usr/lib/libc++abi.dylib
 in /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
3 Likes

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