Installing tidyverse package keep on not installing properly

Version: RStudio 2022.07.0+548 "Spotted Wakerobin" Release (34ea3031089fa4e38738a9256d6fa6d70629c822, 2022-07-06) for macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4_0) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

Hi,

I've been struggling for hours to solve this problem.
Here's what happens when I run install.packages("tidyverse")

install.packages("tidyverse")

also installing the dependencies ‘cli’, ‘dplyr’, ‘vctrs’, ‘dbplyr’
 There are binary versions available but the source versions are later:
          binary source needs_compilation cli        3.2.0  3.3.0              TRUE dplyr      1.0.8  1.0.9              TRUE vctrs      0.4.0  0.4.1 TRUE dbplyr     2.1.1  2.2.1             FALSE tidyverse  1.3.1  1.3.2 FALSE

Do you want to install from sources the packages which need compilation? (Yes/no/cancel) no trying URL 'https://mirror.rcg.sfu.ca/mirror/CRAN/bin/macosx/contrib/4.0/cli_3.2.0.tgz' Content type 'application/octet-stream' length 1151378 bytes (1.1 MB)
================================================== downloaded 1.1 MB

trying URL 'https://mirror.rcg.sfu.ca/mirror/CRAN/bin/macosx/contrib/4.0/dplyr_1.0.8.tgz' Content type 'application/octet-stream' length 1296204 bytes (1.2 MB)
================================================== downloaded 1.2 MB

trying URL 'https://mirror.rcg.sfu.ca/mirror/CRAN/bin/macosx/contrib/4.0/vctrs_0.4.0.tgz' Content type 'application/octet-stream' length 1729317 bytes (1.6 MB)
================================================== downloaded 1.6 MB


The downloaded binary packages are in 	/var/folders/f6/_7s3zhw96r708r9tg_1kgzl80000gn/T//RtmpaUCrbe/downloaded_packages installing the source packages ‘dbplyr’, ‘tidyverse’

trying URL 'https://mirror.rcg.sfu.ca/mirror/CRAN/src/contrib/dbplyr_2.2.1.tar.gz' Content type 'application/octet-stream' length 670569 bytes (654 KB)
================================================== downloaded 654 KB

trying URL 'https://mirror.rcg.sfu.ca/mirror/CRAN/src/contrib/tidyverse_1.3.2.tar.gz' Content type 'application/octet-stream' length 702514 bytes (686 KB)
================================================== downloaded 686 KB

* installing *source* package ‘dbplyr’ ...
** package ‘dbplyr’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :    namespace ‘cli’ 3.2.0 is already loaded, but >= 3.3.0 is required Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace Execution halted ERROR: lazy loading failed for package ‘dbplyr’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/dbplyr’ Warning in install.packages :   installation of package ‘dbplyr’ had non-zero exit status ERROR: dependency ‘dbplyr’ is not available for package ‘tidyverse’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/tidyverse’ Warning in install.packages :   installation of package ‘tidyverse’ had non-zero exit status

The downloaded source packages are in 	‘/private/var/folders/f6/_7s3zhw96r708r9tg_1kgzl80000gn/T/RtmpaUCrbe/downloaded_packages’

It seems to work perfectly. But when I run this:

library(tidyverse)

I get this:

Error in library(tidyverse) : there is no package called ‘tidyverse’

I tried many things from solutions I found on internet. Here's what I've tried so far:

  • Uninstall R Studio from my desktop
  • Make sure it was the most recent version
  • Change CRAN mirror. I came
    back to the default mirror. See image: enter image description
    here

I'm quite discouraged by this. I can't keep going on my
work...

If someone could help me find the solution it would be very appreciated!

I don't think I agree with this. Looking at your output:

If you look at the last three lines of this, you will see a few different errors in downloading you packages. I would start with a new R session, try installing tidyverse before loading any other packages, and if that doesn't work, try to install dbplyr by itself and see what you get.

Ok thanks for your answer. I tried what you suggested, but it doesn't seem to work either.

install.packages('dbplyr')
also installing the dependencies ‘cli’, ‘dplyr’, ‘vctrs’

There are binary versions available but the source versions are later:
binary source needs_compilation
cli 3.2.0 3.3.0 TRUE
dplyr 1.0.8 1.0.9 TRUE
vctrs 0.4.0 0.4.1 TRUE
dbplyr 2.1.1 2.2.1 FALSE

Do you want to install from sources the packages which need compilation? (Yes/no/cancel) no
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/cli_3.2.0.tgz'
Content type 'application/x-gzip' length 1151378 bytes (1.1 MB)

downloaded 1.1 MB

trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/dplyr_1.0.8.tgz'
Content type 'application/x-gzip' length 1296204 bytes (1.2 MB)

downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/vctrs_0.4.0.tgz'
Content type 'application/x-gzip' length 1729317 bytes (1.6 MB)

downloaded 1.6 MB

The downloaded binary packages are in
/var/folders/f6/_7s3zhw96r708r9tg_1kgzl80000gn/T//RtmpOtFXch/downloaded_packages
installing the source package ‘dbplyr’

trying URL 'https://cran.rstudio.com/src/contrib/dbplyr_2.2.1.tar.gz'
Content type 'application/x-gzip' length 670569 bytes (654 KB)

downloaded 654 KB

  • installing source package ‘dbplyr’ ...
    ** package ‘dbplyr’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
    namespace ‘cli’ 3.2.0 is already loaded, but >= 3.3.0 is required
    Calls: ... namespaceImportFrom -> asNamespace -> loadNamespace
    Execution halted
    ERROR: lazy loading failed for package ‘dbplyr’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/dbplyr’
    Warning in install.packages :
    installation of package ‘dbplyr’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/f6/_7s3zhw96r708r9tg_1kgzl80000gn/T/RtmpOtFXch/downloaded_packages’

I believe this to be your issue: You are answering "no" to the question

Do you want to install from sources the packages which need compilation?

When you do this, you are saying "install cli version 3.2", but dbplyr depends on cli version 3.3.

Does answering yes to that question solve the problem for you?

This is asking you to update cli but te latest version is only available for your R version as source, so you need to choose to compile from source.

Have in mind that for compiling packages from source you need to install Xcode in your system (not in R) and the recommended development tools for macOS systems.
https://mac.r-project.org/tools/

Another option would be to update to the latest R version (4.2.1) so you can get access to precompiled binaries.

1 Like

No, I've tried that multiple times and it didn't change anything...

Hi,
I'm not sure to get what you're saying about Xcode. I'll install it but what exactly am I supposed to do after ?

Also, I just checked and I have the most recent version of R studio

This is a tool R needs to compile packages from source, it simply enables you to choose "yes" when asked if you want to install from source.

RStudio is an IDE for the R programming language but they have independent versions, you might have the latest RStudio version but you definitely do not have the latest R version. You are using a 4.0.x version whereas the latest is 4.2.1 you can download it from here

https://cran.r-project.org/bin/macosx/

1 Like

Thanks again for all of that information! That worked perfectly !

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.