Tidyverse package v1.2.0 installation/loading solutions

There are currently at least 3 separate issues that may be preventing people from installing the tidyverse package (if your installation compiles from source), or loading it after installation (if you use pre-compiled binaries). I'll cover the problems along with solutions, but also list some temporary workarounds at the bottom of this post if you can't use the given solutions for any reason. These problems are all fixed in the development version of the package (instructions for installing below), but for those teaching classes or otherwise needing more straightforward solutions right now, knowing workarounds/fixes may be useful until then.

  1. Upgrade to the current version of RStudio. If you are using a pre-1.1 version of the RStudio IDE, you'll get the error:
library(tidyverse)
Error : .onAttach failed in attachNamespace() for ‘tidyverse’, details:
call: NULL
error: Function getThemeInfo not found in RStudio
Error: package or namespace load failed for ‘tidyverse’

The only non-workaround is to upgrade your IDE, if you can.

  1. Update your other packages. Older versions of the crayon and purrr packages will cause issues, and potentially others. You can do this with the "Update" button in the RStudio IDE:
    image
    Just make sure you de-select the tidyverse package for the initial update, if you compile from source.

  2. Select an editor theme for RStudio. Under Tools → Global Options → Appearance, you will see a list of "Editor Themes". Some people's installs somehow fail to have a theme selected, which causes the error below. Selecting any of the themes (you are likely defaulted to TextMate if you have this bug) will fix the issue. Just make sure to hit "OK" after selecting!

Error: package or namespace load failed for ‘tidyverse’:
 .onAttach failed in attachNamespace() for 'tidyverse', details:
  call: if (theme$dark) crayon::white(x) else crayon::black(x)
  error: missing value where TRUE/FALSE needed

If the solution to your problem isn't listed, or you can't use the solutions provided due to not having full control over your R/RStudio installation, then you should downgrade the tidyverse package for now (thanks to @JeffR for the instructions):

if (!require("devtools")) install.packages("devtools")
devtools::install_version(“tidyverse”, version = “1.1.1”, repos = “http://cran.us.r-project.org”)

If you prefer to live on the edge and install from the source on Github, these problems are already fixed in the development version. However, installing that with the command below will likely also install development versions of other packages as well, so buyer beware!

if (!require("devtools")) install.packages("devtools")
devtools::install_github("tidyverse/tidyverse")

Alternatively, you can always avoid using the tidyverse package by individually loading packages such as dplyr and purrr, but that has its own annoyances.

This post summarizes the troubleshooting from the following threads, put here to make them linked to this thread. Thanks to all that did some back-and-forth with me to figure these out!

9 Likes

This is awesome, Nick! Great breakdown. :+1:

I’ll aim to release the fixes to CRAN next week. Thanks for writing this up!

All problems now fixed in the dev version!

3 Likes

Now on its way to CRAN

5 Likes

Thanks for your effort, hadley!

And on CRAN now :slight_smile: It'll probably be a day or so before windows and mac binaries are available.

Unless someone has changed the default options, install.packages("tidyverse") should install from the newer version from source by default even without binaries on those platforms, right? I'm going to edit my original post, but don't want to tell people to add type = "source" unless necessary, as even something little like that may scare someone off updating unnecessarily.

The v1.2.1 update works for me. Thanks for the fix.

I was one of those on a pre-v1.1 RStudio installation.

Hadley,
Can't update 'tidyverse' from Rstudio.
Tried the following:
> tidyverse:: tidyverse_update(recursive = FALSE)
It says
The following packages are out of date: ● broom (0.4.2 -> 0.4.3) ● hms (0.3 -> 0.4.0)

I updated the above two packages which in turn installed: lubridate then it loaded a few more and then the same old error pops up:

Error: package or namespace load failed for ‘tidyverse’: .onAttach failed in attachNamespace() for 'tidyverse', details: call: NULL error: Function getThemeInfo not found in RStudio

tidyverse_update won't update the tidyverse package itself. If you use install.packages("tidyverse"), that should do the trick.