Having trouble installing and loading tidyverse/readr- No hms package

Hi! Welcome!

First of all, a little bit of disambiguation: R and RStudio are different things — your problem here seems to involve only R.

R's package installation messages can be quite cryptic until you get used to them, and lots of people stumble on this sort of problem. Unfortunately, the status messages aren't written with the new user in mind! So the simple answer is that hms is actually failing to install (which is why you keep getting the error that it's missing), because of an upstream problem installing rlang. rlang fails to install because you are running an old version of R, so the first step is probably to update R and then try it all again.


In the hopes of flattening the learning curve a little bit, here's the longer version!

install.packages('readr')
Installing package into ‘C:/Users/Guillaume/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘rlang’, ‘hms’

R is going to try to install readr into the default library. First it will need to install readr's dependencies, rlang and hms. (This much was probably obvious!)

Des versions binaires sont disponibles mais les versions des sources
sont plus récentes:
      binary source needs_compilation
hms   0.3    0.4.2  FALSE
readr 1.1.0  1.1.1  TRUE

Binaries will be installed
Package which is only available in source form, and may need compilation
of C/C++/Fortran: ‘rlang’
These will not be installed

This is where things start to go wrong.

The gory details...

I don't know how much experience you have with programming in general, so I apologize if I explain things you already know! Many R packages are written in R. Since R is an interpreted language, source code written in R doesn't have to be translated into system-specific machine language before running. However, some R packages have significant portions written in other, compiled languages, usually C/C++ or Fortran. These languages need accessory software tools to translate ("compile") their source code into machine language that can run on a particular system.

You have two choices when distributing code for compiled languages: you can distribute source code only, and expect the user to have the right compiler software (and skills) to build system-specific runnable code themselves. Or you can prepare compiled "binaries" matched against common systems, so that people can run code without having to know how to compile it.

CRAN uses a mixed strategy. On UNIX/Linux, only source code is distributed and all packages are compiled from source during installation (for packages written entirely in R, this is trivial!). For Windows and Mac, CRAN makes pre-compiled binaries available. On Windows, install.packages() will only install precompiled binaries, unless explicitly forced to install from source (you can read a lot more about this in the R Installation and Administration guide). In order to install from source on Windows, you first need to install a set of software dependencies called the "RTools" (available from that link).

OK, so, what about your situation? You appear to be running a fairly old version of R — 3.2, when the current version is 3.5 (major R versions are now released once per year, so R 3.2 is 3 years out of date). As your R version gets more and more out of date, it gets less likely that there will be package binaries available for your system. In fact, there is no binary version of rlang available for R 3.2 running on Windows 10, since the package rlang didn't even exist when the binaries for R 3.2 were compiled (it was first released on CRAN in 2017).

So rlang is not actually installed (the lines Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘rlang’ / These will not be installed is trying to warn you of this). In addition, R warns you that it is installing an old version of readr because the newer version is only available as source and has code that needs to be compiled. hms does not need to be compiled (it's written only in R), so R can install the latest source version, and attempts to do so.

Next, R downloads the binary package for readr and the source package for hms. This works! But when R starts actually installing, it predictably runs into trouble:

ERROR: dependency 'rlang' is not available for package 'hms'

removing 'C:/Users/Guillaume/Documents/R/win-library/3.2/hms'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\Guillaume\Documents\R\win-library\3.2" C:\Users\GUILLA~1\AppData\Local\Temp\RtmpaGedIv/downloaded_packages/hms_0.4.2.tar.gz' had status 1
Warning in install.packages :
installation of package ‘hms’ had non-zero exit status

hms depends on rlang, and rlang was not installed. So hms cannot be installed. The key line is installation of package ‘hms’ had non-zero exit status — that cryptic statement means that the named package failed to install.

What can you do?

First, it's probably a good idea to update R to the latest version (3.5.1). You will then need to reinstall all your packages, but hopefully that will go more smoothly now that package binaries will be more available.

You might consider installing RTools for Windows in case you run into any packages that still need to be installed from source (binaries are not always available). On Windows, to install a package from source you will need to explicitly run install.packages("packageName", type = "source").

Let me know how it goes, and If you run into any more trouble definitely post back!

P.S. I don't know why the package installation messages are only partially localized. I've never tried to run R on a system with a non-English locale, so I don't know if this is typical or not.

4 Likes