12

I'm trying to install the 'lifecycle' package but rlangs is required.

Upon typing install.packages('lifecyle') I get the error that I'm importing a rlangs package which is newer than required ('rlang' 0.4.5 is being loaded, but >= 0.4.10 is required).

  • installing source package 'lifecycle' ...
    ** package 'lifecycle' successfully unpacked and MD5 sums checked
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    namespace 'rlang' 0.4.5 is being loaded, but >= 0.4.10 is required
    ERROR: lazy loading failed for package 'lifecycle'
  • removing 'C:/Users/user/R/library/lifecycle' In R CMD INSTALL
    Warning in install.packages : installation of package ‘lifecycle’ had non-zero exit status

I've already uninstalled rlangs and reinstalled it on its own, but it still not working.

Not sure if it helps, but I get the following message beforehand:

There are binary versions available but the source versions are later:
rlang - binary: 0.4.5 - source: 0.4.10 - needs_compilation: TRUE
lifecycle - binary: 0.2.0 - source: 1.0.0 - needs_compilation: FALSE

This error makes little sense and differs from others posts with this kind of error.

Victor Galuppo
  • 187
  • 2
  • 2
  • 8
  • 2
    Can you please tell us what is the output of `packageVersion("rlang")` after making `install.packages("rlang")`? – Basti Mar 24 '21 at 14:10
  • Sure! It's packageVersion("rlang") [1] ‘0.4.5’. If it helps, I've updated my post with more information on the message upon installing "lifecycle". – Victor Galuppo Mar 24 '21 at 14:18
  • 1
    Thanks, maybe you could try installing via github `devtools::install_github("r-lib/rlang", build_vignettes = TRUE)` – Basti Mar 24 '21 at 14:24

5 Answers5

15

You should try removing remove.packages("rlang") then install.packages("rlang")

CrunchyTopping
  • 803
  • 7
  • 17
Jean Castro
  • 311
  • 2
  • 6
  • 6
    This worked for me but I had to replace remove.packages(rlang) with remove.packages("rlang") – jruf003 Nov 03 '22 at 02:09
  • Removing the package is overkill. It works, but that's because removal does the real need: detaching the package and unloading the shared library (`rlang.dll`). This can normally be done with something like `detach("package:rlang", unload=TRUE)` (assuming no other packages are depending on it.) – r2evans Apr 24 '23 at 12:03
8

First of all: your version is not newer, it's older. 0.4.5 < 0.4.10.

The issue is that for whatever reason the binary version you have access to is of version 0.4.5, but the source version (which needs compiling) is of version 0.4.10.

I believe the simplest solution would be downloading the source package and installing it as source.

install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.4.10.tar.gz", repos = NULL, type="source")

Now, if you don't want the trouble, I belive another possible solution would be updating your R version, which will in turn update the binary versions available for most packages.

eduardokapp
  • 1,612
  • 1
  • 6
  • 28
  • 1
    Your solution returned a message that my RStudio was out of date. I've updated it and everything worked. Thanks! – Victor Galuppo Mar 24 '21 at 15:07
  • @eduardokapp the path needs updating to https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.4.10.tar.gz – adolf garlic Aug 13 '21 at 09:39
  • I tried your solution and I got the message: "packages/rlang_0.4.10.tar.gz’ had non-zero exit status". I guess this means whatever I was doing was not successful. What gives? – Faustin Gashakamba Sep 13 '21 at 10:41
  • 1
    @FaustinGashakamba it's hard to tell with that much information. Consider searching for that error message here in SO. – eduardokapp Sep 13 '21 at 18:14
  • how is 10 (ten) older than 5 (five)? – adolf garlic Jan 13 '22 at 16:43
  • the solution did not work for me: *** arch - i386 Warning in system(cmd) : 'make' not found ERROR: compilation failed for package 'rlang' * removing 'C:/Program Files/R/R-3.5.1/library/rlang' * restoring previous 'C:/Program Files/R/R-3.5.1/library/rlang' – adolf garlic Jan 14 '22 at 08:20
  • Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) : problem copying C:\Program Files\R\R-3.5.1\library\00LOCK-rlang\rlang\libs\x64\rlang.dll to C:\Program Files\R\R-3.5.1\library\rlang\libs\x64\rlang.dll: Permission denied In R CMD INSTALL Warning in install.packages : installation of package ‘C:/Users/xxxxxx/AppData/Local/Temp/zzzzzzz/downloaded_packages/rlang_0.4.10.tar.gz’ had non-zero exit status – adolf garlic Jan 14 '22 at 08:20
  • Apologies, I had to split the error message above due to the char limitation – adolf garlic Jan 14 '22 at 08:21
1

Not sure why but it worked for me, close all files in rstudio editor and run in the console:

install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.4.10.tar.gz", repos = NULL, type="source")

J. Dowee
  • 369
  • 1
  • 4
  • 9
  • 1
    Additionally recommended - just install the latest rlang `install.packages("rlang")` worked for me. – puslet88 Nov 14 '22 at 16:59
1

RStudio needs rlang and maybe other package to do the R code diagnostics. Hence it loads it whenever the global option R diagnositics is checked. Try to uncheck it, restart the R session:

enter image description here

Edgar Manukyan
  • 1,153
  • 10
  • 21
0

I had the same problem, and when I tried to update the rlang package, it told me that rlang could not be unloaded as it was required by something else (I presume when you try to update, the package gets unloaded and then the latest version gets loaded). After coming to this question and reading some answers, I saw that I should move to the latest version in R Studio Cloud - Image with arrow indicating how to move to the latest version in R Studio Cloud

Jammy
  • 13
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Chris Nov 28 '22 at 23:46