Error installing tidyverse - no package called ‘Rcpp’ but still getting error after installing Rcpp

Hi,
I am trying to load the tidyverse package and I get the following error:

library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘Rcpp’

I tried running:

install.packages("Rcpp")

But I still get the same error. Please, help!

Can you post the message you get when you try to install Rcpp?

When I try not to do this, I get:

The downloaded source packages are in
	‘/private/var/folders/t7/_7tx98j130n2p0xr_ql714rr0000gn/T/RtmpwMmkeQ/downloaded_packages’
> install.packages("Rcpp")

  There is a binary version available but the source version is later:
     binary  source needs_compilation
Rcpp  1.0.4 1.0.4.6              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes
installing the source package ‘Rcpp’

trying URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.4.6.tar.gz'
Content type 'application/x-gzip' length 2751467 bytes (2.6 MB)
==================================================
downloaded 2.6 MB

* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp’
Warning in install.packages :
  installation of package ‘Rcpp’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/t7/_7tx98j130n2p0xr_ql714rr0000gn/T/RtmpwMmkeQ/downloaded_packages’

The easiest solution would be to answer "no" to this question, you would get a precompiled binary version that is a little older but much easier to install.
If you need to install the latest version from source, then you need to install xcode in your system (not in R) and the recommended development tools for MacOS systems.
https://cran.r-project.org/bin/macosx/tools/

I have the same issue. After reading through several posts,
I tried the following and it still didn't work,
(1) Updated XCode
(2) Tried install.packages("Rcpp", dependencies = TRUE) and install.packages("Rcpp", dependencies = FALSE)
(3) install.packages("tidyverse", repo = 'https://mac.R-project.org')
(4) Uninstalled and reinstalled R and RStudio
(5) Updated all packages

None of these worked for me. The only thing that worked is what was recommended here by @andresrcs. Although it is not clear to me what this means. After installing Rcpp successfully, I was able to install tidyverse.

I wonder if others have had this issue and what is the reason behind it. If I understand correctly, this is an issue for Mac users.

NOTE: Only Rcpp seems to be the issue. All other packages and updates work well. If I try to update it after installation, that also doesn't work.

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