Tidyverse won't install

Looks like the dependency issue that it looks like a lot of people have.

I reinstalled RStudio then downloaded tidyverse with this:

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

Then I tried to open the tidyverse using:

library(tidyverse)

It told me it needed Haven so I tried to install that, and then it told me I needed readr so I tried to install that but it wouldn't.

So, now I'm stuck. I'm pretty new at all this and it's v off-putting. I was working away/learning some stuff now I'm losing whole chunks of a day by not being able to get the software to work.

Can anyone point me in the right direction?

Here's the code version:

> 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 ‘haven’
> install.packages("haven")
Installing package into ‘C:/Users/Antony.LAPTOP/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
      binary source needs_compilation
haven  1.1.2  2.0.0              TRUE

installing the source package ‘haven’

trying URL 'https://cran.rstudio.com/src/contrib/haven_2.0.0.tar.gz'
Content type 'application/x-gzip' length 204563 bytes (199 KB)
downloaded 199 KB

ERROR: dependency 'readr' is not available for package 'haven'
* removing 'C:/Users/Antony.LAPTOP/Documents/R/win-library/3.5/haven'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘haven’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\Antony.LAPTOP\AppData\Local\Temp\Rtmpm4urVj\downloaded_packages’
> install.packages("readr")
Installing package into ‘C:/Users/Antony.LAPTOP/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
      binary source needs_compilation
readr  1.1.1  1.2.1              TRUE

installing the source package ‘readr’

trying URL 'https://cran.rstudio.com/src/contrib/readr_1.2.1.tar.gz'
Content type 'application/x-gzip' length 358690 bytes (350 KB)
downloaded 350 KB

ERROR: failed to lock directory 'C:/Users/Antony.LAPTOP/Documents/R/win-library/3.5' for modifying
Try removing 'C:/Users/Antony.LAPTOP/Documents/R/win-library/3.5/00LOCK-readr'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘readr’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\Antony.LAPTOP\AppData\Local\Temp\Rtmpm4urVj\downloaded_packages’
1 Like

You could try below steps and check if it works:

  • exist RStudio

  • rename the locked file ('C:/Users/Antony.LAPTOP/Documents/R/win-library/3.5/00LOCK-readr' to 'C:/Users/Antony.LAPTOP/Documents/R/win-library/3.5/00LOCK-readr_old')

  • delete the renamed LOCK file

  • open R terminal from your R installation bin directory

  • and try reinstalling the package

1 Like

image

In the screenshot, the problem is just a simple typo (you have install.packages(tidyverse) instead of install.packages("tidyverse").

However, looking at your first post, I suspect that something went wrong in your initial tidyverse installation attempt. R's package installation messages are unfortunately not written with the novice in mind, so it is common that people don't notice the important bits. readr is one of the core tidyverse packages, so a successful tidyverse installation (even without dependencies = TRUE!) should have left you with a working installation of readr.

I'd vary a little bit from what @arihanth recommended, and suggest the following:

  1. Definitely delete that LOCK file, if you haven't already!
  2. Try installing tidyverse again. You can do this from RStudio or from RGui.exe, or even from the terminal — what matters most is that you do it in a clean session. Launch fresh, and do not run any code or load any packages before installing. If you have R set up so that it is automatically restoring stuff from your last session, then find the file called .Rdata (may be hidden by your OS) in your default working directory and rename it before starting up R or RStudio.
  3. In a new post here, on a blank line, click the little </> button at the top of the posting box. This will insert a small template with the words “type or paste code here” selected.
  4. Copy all the output from the console that was generated when you tried to install tidyverse (no screenshots please!)
  5. Paste the output here, replacing the “type or paste code here” line in the template,

(Following these steps makes it easier for helpers to read what you post and keeps the forum software from garbling it. If for some reason the console output winds up too long to post here, please post it as a Github gist or PasteBin paste or similar and link to it)

The goal here is to attempt a re-install of tidyverse and to examine the console output to determine what might be going wrong.

It's definitely frustrating to run into these installation problems! The only reassurance I can offer is that on average, it's not this hard, and that despite the confusion induced by the gnarly communication from R, most problems have fairly simple solutions in the end.

4 Likes

Just wanted to add a note, based on something I discovered elsewhere:

A new version of readr was released to CRAN approximately yesterday, and it appears that pre-compiled binaries for Windows are in a kind of weird, intermediate stage as far as availability. This means that if you tried to install tidyverse since yesterday, R may have tried to compile readr from source, which will fail on a Windows system where you haven't installed the RTools (a bunch of external compiler software).

It seems likely that this will resolve itself in the next few days as CRAN's gears finish turning, at which point a pre-compiled (= easy to install) binary of readr will hopefully once again become available for Windows!

Gory details for those who are curious...

cran.r-project.org as of 2018-11-23 22:24 UTC:

Package source: readr_1.2.1.tar.gz
Windows binaries: r-devel: readr_1.1.1.zip, r-release: readr_1.1.1.zip, r-oldrel: readr_1.2.0.zip
OS X binaries: r-release: readr_1.1.1.tgz, r-oldrel: readr_1.1.1.tgz

CRAN checks results page:

Last updated on 2018-11-23 23:01:45 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.2.1 209.80 52.97 262.77 NOTE
r-devel-linux-x86_64-debian-gcc 1.2.1 194.77 41.46 236.23 NOTE
r-devel-linux-x86_64-fedora-clang 1.2.1 380.55 NOTE --no-tests
r-devel-linux-x86_64-fedora-gcc 1.2.1 257.54 NOTE
r-devel-windows-ix86+x86_64 1.2.1 573.00 127.00 700.00 NOTE
r-patched-linux-x86_64 1.1.1 234.72 47.52 282.24 WARN
r-patched-solaris-x86 1.2.1 410.20 NOTE
r-release-linux-x86_64 1.2.0 243.79 50.61 294.40 NOTE
r-release-windows-ix86+x86_64 1.2.1 574.00 124.00 698.00 NOTE
r-release-osx-x86_64 1.2.1 NOTE
r-oldrel-windows-ix86+x86_64 1.2.0 611.00 149.00 760.00 NOTE
r-oldrel-osx-x86_64 1.2.1 NOTE
2 Likes

Thankyou so much for your detailed and helpful reply, JC. I followed your instructions and have got into RStudio successfully. It may just have been the thing with the binaries in your second post. Antony

1 Like

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

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