Home > database >  Error with install.packages using renv|knit|rmarkdown
Error with install.packages using renv|knit|rmarkdown

Time:09-28

I'm updating the renv folder from a project in order to adjust the libraries, but it seems I'm having a permission problem. After running renv::init() and trying to installing manually the remaining libraries using install.packages() I always get the message

Error: failed to retrieve 'https://cran.rstudio.com/bin/windows/contrib/4.2/ipeadatar_0.1.6.zip' [error code 23]
1: curl: (23) Failure writing output to destination
2: curl: (23) Failure writing output to destination

Using .libPath() I can see that the renv was created in the "AppData" hidden folder

1] "C:/Users/André Ferreira/AppData/Local/R/cache/R/renv/library/MacroBRA_Wrld-09789847/R-4.2/x86_64-w64-mingw32"

So checking my permissions, I couldn't see anything wrong. Any thoughts about this problem? The thing it's that when I open my .Rmd file and try to knit, I receive the same message "1: curl: (23) Failure writing output to destination", now from rmarkdown retrieve installation, so it may be a configuration/permission problem.

Adding "C:\rtools42\usr\bin" and "C:\Program Files\R\R-4.2.1\bin" in the environment variable didn't help.

As I could see, opening an empty file from rstudio, I could use install.packages() without problem.

CodePudding user response:

Although this doesn't solve the problem directly, you can also instruct renv to use a different library path with something like:

# use a project-local library path
RENV_PATHS_LIBRARY = renv/library

in your project's .Renviron file. Depending on your environment, you might also consider placing the library path in an alternate location.

See https://rstudio.github.io/renv/articles/packages.html#r-cmd-build-and-the-project-library for more details.

  • Related