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

Hi everyone, I am new to R and I experience a major problem I am unable to fix. I want to use the readr package, which is included in the whole Tidyverse package. When I install them (either Tidyverse as a whole or just readr individually), I manage to get them installed, but when I come to load readr, it fails with the message that 'hms' hasn't been found that thus readr fails to load.

I googled around for the awner through most of the evening and then looked at the suggestions of similar topics that was given to me by this site editor, yet none seems to do it. I tried to install while turning the "dependencies" argument to TRUE, without change. I tried to install 'hms' and 'rlang' individually, without change. Also, oddly, while my RStudio is in english, the error messages are in french (I understand the language, but I find it odd). Here's the output of the installation:

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’

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
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/readr_1.1.0.zip'
Content type 'application/zip' length 1177141 bytes (1.1 MB)
downloaded 1.1 MB

package ‘readr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\Guillaume\AppData\Local\Temp\RtmpaGedIv\downloaded_packages
installing the source package ‘hms’

trying URL 'https://cran.rstudio.com/src/contrib/hms_0.4.2.tar.gz'
Content type 'application/x-gzip' length 12773 bytes (12 KB)
downloaded 12 KB

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

The downloaded source packages are in
‘C:\Users\Guillaume\AppData\Local\Temp\RtmpaGedIv\downloaded_packages’

And the output of the loading:

library("readr", lib.loc="~/R/win-library/3.2")
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
aucun package nommé ‘hms’ n'est trouvé
In addition: Warning message:
le package ‘readr’ a été compilé avec la version R 3.2.5
Error: le chargement du package ou de l'espace de noms a échoué pour ‘readr’

I'm a windows 10 user. Please help, I feel other people might google the issue and see us solve it. I hope to make great contributions too.

Thank you so much

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

Hi Guillaume, what about updating your R version and RStudio to latest? I'm no expert but in your output, readr was built under R 3.2.5?

Also here are two links about language output problems in R:

https://cran.r-project.org/bin/windows/base/rw-FAQ.html#I-want-R-in-English_0021

and...

2 Likes

Hi all !

I did indeed realize I had an obsolete version of R, to which I updated to the latest and IT DID WORK.

I feel so dumb that the problem was so easy, yet I couldn't come across it. Thank you SO MUCH. It's really appreciated. I hope other learners can come upon this thread if they come upon the issue.

Thank you again !!

1 Like

Don't feel dumb Guillaume - yesterday I spent a few hours trying to figure out why my code wouldn't work and it turned out to be a case sensitive issue! I felt really stupid but it's how we learn. Glad the problem is sorted :smile:

1 Like

Glad you got it sorted!

If your question's been answered (even if by you), would you mind choosing a solution? (See FAQ below for how).

Having questions checked as resolved makes it a bit easier to navigate the site visually and see which threads still need help.

Thanks

Hi,
I install Rtool 3.5 and R 3.5.3 and have the same issue mentioned above.
I try to install tidyverse, but rvest resists to be installed. It was easy to install data.table package though.
Thank you for help.

> install.packages("rvest")
Installing package into ‘C:/Users/Stewart Li/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
rvest  0.3.2  0.3.3             FALSE

installing the source package ‘rvest’

trying URL 'https://cran.rstudio.com/src/contrib/rvest_0.3.3.tar.gz'
Content type 'application/x-gzip' length 1631059 bytes (1.6 MB)
downloaded 1.6 MB

* installing *source* package 'rvest' ...
** package 'rvest' successfully unpacked and MD5 sums checked
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'rvest'
    finding HTML links ... done
    encoding                                html  
    google_form                             html  
    html                                    html  
    html_form                               html  
    html_nodes                              html  
    html_session                            html  
    html_table                              html  
    html_tag                                html  
    html_text                               html  
    jump_to                                 html  
    minimal_html                            html  
    pipe                                    html  
Rd warning: C:/Users/Stewart Li/AppData/Local/Temp/Rtmp2dtsN0/R.INSTALL11dc360e1977/rvest/man/pipe.Rd:10: file link '%>%' in package 'magrittr' does not exist and so has been treated as a topic
    pluck                                   html  
    rvest-package                           html  
    session_history                         html  
    set_values                              html  
    submit_form                             html  
    xml                                     html  
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Fatal error: cannot open file 'C:\Users\Stewart': No such file or directory

*** arch - x64
Fatal error: cannot open file 'C:\Users\Stewart': No such file or directory

ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/Stewart Li/Documents/R/win-library/3.5/rvest'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘rvest’ had non-zero exit status

The downloaded source packages are in
	‘C:\tmp\RtmpIRN3wX\downloaded_packages’

Do you need the last version 0.3.3 or is binary ok ? Did you try to install the binary ?

The issue seems to be with installation from source on your computer.

Also, please next time, open a new issue and link to other related instead of continue in a very old thread. Thanks ! :slight_smile:

1 Like

Thank you very much for reminding me. I thought needs_compilation is FALSE, so don't have to specify it. Well, I was wrong. install.packages("rvest", type = "binary") works.

There is a binary version available but the source version is later:
      binary source needs_compilation
rvest  0.3.2  0.3.3             FALSE

I had this issue running R Version 3.4.3 and installing readr for the first time. Though it seems updating R to the latest version works fine, I could not easily do that since the software is regulated by my employer. I was able to install hms from source and then install readr without issue. See below:

hmsurl <- "https://cran.r-project.org/src/contrib/Archive/hms/hms_0.4.2.tar.gz"
install.packages(hmsurl, repos=NULL, type="source")
install.packages('readr')