Error installing stringr and rmarkdown - windows 10

I have been trying to knit to pdf or word and i keep getting a message that markdown, stringr and rmarkdown need to be updated. I have tried install all of them, and only markdown will install.
I have the newest version of R and last week was able to knit. Please help, as i am so incredibly frustrated. Many thanks!!!!
I'm unable to paste the entire error message with links.

install.packages("stringr")
also installing the dependencies ‘cli’, ‘glue’, ‘lifecycle’, ‘rlang’

There are binary versions available but the source versions are later:
binary source needs_compilation
cli 2.5.0 3.6.1 TRUE
glue 1.4.2 1.6.2 TRUE
lifecycle 1.0.0 1.0.4 FALSE
rlang 0.4.11 1.1.2 TRUE
stringr 1.4.0 1.5.0 FALSE

package ‘cli’ successfully unpacked and MD5 sums checked
package ‘glue’ successfully unpacked and MD5 sums checked
package ‘rlang’ successfully unpacked and MD5 sums checked

cran.rstudio.com/src/contrib/stringr_1.5.0.tar.gz'
Content type 'application/x-gzip' length 175699 bytes (171 KB)
downloaded 171 KB

  • installing source package 'lifecycle' ...
    ** package 'lifecycle' successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    namespace 'rlang' 0.4.11 is being loaded, but >= 1.1.0 is required
    Calls: ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
    Execution halted
    ERROR: lazy loading failed for package 'lifecycle'
  • removing 'C:/Users/Public/anaconda3/envs/rstudio/lib/R/library/lifecycle'
    Warning in install.packages :
    installation of package ‘lifecycle’ had non-zero exit status
    ERROR: dependency 'lifecycle' is not available for package 'stringr'
  • removing 'C:/Users/Public/anaconda3/envs/rstudio/lib/R/library/stringr'
    Warning in install.packages :
    installation of package ‘stringr’ had non-zero exit status

I think you need to update {rlang}

Try

install.packages("rlang") 

and retry.

In addition, make sure you do not load packages from your ~/.Rprofile. You might load rlang for there and then you cannot update it. You cannot update loaded packages that have a .dll file on Windows.

Hi,
Thank you for the suggestions. I downloaded rlang, and it installed fine. I then tried to install stringr and still getting errors and it won't load.
Gabor, i'm unsure what you mean from my ~/.Rprofile? I have tried installing using the packages tab, the tools/installpackages and also in the console install packages ()

Kristina

What is the output of this?

writeLines(readLines("~/.Rprofile"))

What is the output of this?

packageVersion("rlang")

What is the output of the failed installation or load? I.e. of this?

install.packages("stringr")
library(stringr)

Also, you can try using the pak package, instead of install.packages(), it does a better jobs if the package you are installing is loaded, and also installs packages from binaries, if possible. It also updated dependent packages, as needed:

install.packages("pak", repos = sprintf(
  "https://r-lib.github.io/p/pak/stable/%s/%s/%s", 
  .Platform$pkgType, 
  R.Version()$os, 
  R.Version()$arch
))

and then

pak::pkg_install("stringr")

I have actually uninstalled and reinstalled Rstudio and this seemed to do the trick, though i'm still unable to knit to pdf...but i am able to knit to word and i've been able to download packages.
Thank you

For the record, and especially for future readers, reinstalling RStudio has no effect at all on R and R package libraries, so in general it will not fix package problems.

Reinstalling R and/or cleaning up package libraries might, on the other hand.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.