Can't install packages with renv

Hi everyone,

I'm trying to get started using renv, but I can't seem to install any packages with renv activated.

I simply get 'Error: package "..." is not available' for any package I try to install, with no further warnings or explanations.

This seems to happen across all projects. Below is a transcript from a completely new/empty project.


R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> renv::init()
* Initializing project ...
* Discovering package dependencies ... Done!
* Copying packages into the cache ... Done!
The following package(s) will be updated in the lockfile:

# CRAN ===============================
- renv   [* -> 0.12.5]

* Lockfile written to '~/Projects/TestProject/renv.lock'.

Restarting R session...

* Project '~/Projects/TestProject' loaded. [renv 0.12.5]
> install.packages("tidyverse")
Error: package 'tidyverse' is not available
> renv::deactivate()

Restarting R session...

> install.packages("tidyverse")
Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/tidyverse_1.3.0.tar.gz'
Content type 'application/x-gzip' length 712837 bytes (696 KB)
==================================================
downloaded 696 KB

* installing *source* package ‘tidyverse’ ...
** package ‘tidyverse’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Warning: replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Warning: replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’
** testing if installed package can be loaded from final location
Warning: replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’
** testing if installed package keeps a record of temporary installation path
* DONE (tidyverse)

The downloaded source packages are in
	‘/tmp/RtmpBmDMyr/downloaded_packages’
> renv::activate()
* Project '~/Projects/TestProject' loaded. [renv 0.12.5]
> install.packages("tidyverse")
Error: package 'tidyverse' is not available

I don't have any idea where to even start looking for the source of this problem. Any help would be greatly appreciated.

2 Likes

Sorry to hear you're having trouble! Can you check a couple things?

  • What is the output of getOption("repos") in your project, when renv is active?

  • Does installation succeed after activating renv, if you use utils::install.packages() directly?

The output of renv::diagnostics() may also be helpful.

1 Like

Thanks for the response. I've responded below

> getOption("repos")
                         CRAN 
"https://cloud.r-project.org" 

yes it completes successfully.

> utils::install.packages("magrittr")
Installing package into ‘/home/garrett/Projects/TestProject/renv/library/R-3.6/x86_64-pc-linux-gnu’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/magrittr_2.0.1.tar.gz'
Content type 'application/x-gzip' length 265580 bytes (259 KB)
==================================================
downloaded 259 KB

* installing *source* package ‘magrittr’ ...
** package ‘magrittr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-t3diwe/r-base-3.6.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c pipe.c -o pipe.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-t3diwe/r-base-3.6.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c utils.c -o utils.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o magrittr.so pipe.o utils.o -L/usr/lib/R/lib -lR
installing to /home/garrett/Projects/TestProject/renv/library/R-3.6/x86_64-pc-linux-gnu/00LOCK-magrittr/00new/magrittr/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (magrittr)

The downloaded source packages are in
	‘/tmp/RtmpJliAwO/downloaded_packages’
> install.packages("magrittr")
Error: package 'magrittr' is not available
> renv::diagnostics()
Diagnostics Report -- renv [0.12.5]
===================================

# Session Info =======================
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.1

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.2 tools_3.6.2    renv_0.12.5   

# Project ============================
Project path: "~/Projects/TestProject"

# Status =============================
* The project is already synchronized with the lockfile.

# Packages ===========================
         Library Source Lockfile Source Path Dependency
magrittr   2.0.1   CRAN     <NA>   <NA>  [1]       <NA>
renv      0.12.5   CRAN   0.12.5   CRAN  [1]     direct
utils       <NA>   <NA>     <NA>   <NA>  [2]   indirect

[1]: /home/user/Projects/TestProject/renv/library/R-3.6/x86_64-pc-linux-gnu
[2]: /tmp/RtmpJliAwO/renv-system-library                                      

# User Profile =======================
[no user profile detected]

# Settings ===========================
List of 7
 $ external.libraries       : chr(0) 
 $ ignored.packages         : chr(0) 
 $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo"
 $ r.version                : chr(0) 
 $ snapshot.type            : chr "implicit"
 $ use.cache                : logi TRUE
 $ vcs.ignore.library       : logi TRUE

# Options ============================
List of 2
 $ renv.consent: logi TRUE
 $ renv.verbose: logi TRUE

# Environment Variables ==============
HOME                        = /home/user
LANG                        = en_US.UTF-8
R_LIBS                      = <NA>
R_LIBS_SITE                 = /usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
R_LIBS_USER                 = /home/user/Projects/TestProject/renv/library/R-3.6/x86_64-pc-linux-gnu:/tmp/RtmpOjgGgV/renv-system-library
RENV_DEFAULT_R_ENVIRON      = <NA>
RENV_DEFAULT_R_ENVIRON_USER = <NA>
RENV_DEFAULT_R_LIBS         = <NA>
RENV_DEFAULT_R_LIBS_SITE    = /usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
RENV_DEFAULT_R_LIBS_USER    = ~/R/x86_64-pc-linux-gnu-library/3.6
RENV_DEFAULT_R_PROFILE      = <NA>
RENV_DEFAULT_R_PROFILE_USER = <NA>
RENV_PROJECT                = /home/user/Projects/TestProject

# PATH ===============================
- /home/user/bin
- /home/user/.guix-profile/bin
- /home/user/.config/guix/current/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin

# Cache ==============================
There are a total of 300 package(s) installed in the renv cache.
Cache path: "~/.local/share/renv/cache/v5/R-3.6/x86_64-pc-linux-gnu"

Thanks! Can you also share the output of:

getOption("download.file.method")
renv:::renv_download_file_method()

I wonder if renv is selecting a different download method that for some reason does not work on your machine. If that's the case, then setting:

RENV_DOWNLOAD_FILE_METHOD = <method>

where <method> is the same as what's currently set for the download.file.method option should help. (That can be set in your project's .Renviron file.)

I would expect installations involving renv to use renv::install(), but it doesnt seem that appears anywhere in this thread ... ?

nevermind, i see its a renv:shims !

Looks like that was it!

getOption("download.file.method") was returning "libcurl"
and renv:::renv_download_file_method() returns "curl"

It looks like I had accidentally to install curl as guix user profile package, so which curl was pointing at "~/.guix_profile/bin/curl" rather than the system curl.

Removing that so R finds the system curl fixed the problem. Though I still don't know what the problem with the guix curl binary was.

Setting RENV_DOWNLOAD_FILE_METHOD="libcurl" worked too, but I didn't actually want the guix package installed, anyway.

Thanks so much for the help!

I also have the same problem when using my Windows machine (I work on the same repo with a Linux machine and a Windows one: linux works great, wereas Windows does not).

I tried to reproduce it by running:

Sys.setenv(RENV_DOWNLOAD_METHOD = "libcurl")

But doesn't work. As a workaround I did the following:

  1. Close the project
  2. Install package as normal (without renv)
  3. Open the project using renv
  4. Restore snapshot

If the packages have previously been installed, they will be symlinked and they would work.

Unfortunately, this is extremely cumbersome, as many packages have dependencies and I have to manually install them all, and that's precisely one of the things I want to avoid and one of the reasons for using renv!

That's what I get:

> getOption("download.file.method")
[1] "wininet"
> renv:::renv_download_file_method()
[1] "curl"
>

And this is the error I get after running: Sys.setenv(RENV_DOWNLOAD_METHOD = "curl") (or wininet or libcurl)

Error: failed to retrieve package 'xfun'
In addition: Warning messages:
1: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
2: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
3: download failed [error code 35]
4: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
5: curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.

HI there.

I have a similar problem.

utils::install.packages works, but install.packages fails with renv and the message

install.packages("data.table")
Error: package 'data.table' is not available

with utils::install.packages:

utils::install.packages("data.table")
Installing package into ‘/home/mshenton/analysis/haplotype_graphics/renv/library/R-4.1/x86_64-pc-linux-gnu’
(as ‘lib’ is unspecified) etc...

Also,

renv:::renv_download_file_method()
Error: object 'renv_download_file_method' not found

Many thanks for any advice here

 renv::diagnostics()
Diagnostics Report [renv 0.14.0]
================================

# Session Info =======================
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=ja_JP.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=ja_JP.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=ja_JP.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=ja_JP.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] renv_0.14.0

loaded via a namespace (and not attached):
[1] BiocManager_1.30.16 compiler_4.1.2      tools_4.1.2        

# Project ============================
Project path: "~/analysis/haplotype_graphics"

# Status =============================
* The project is already synchronized with the lockfile.

# Packages ===========================
             Library Source Lockfile Source Path Dependency
BiocManager  1.30.16   CRAN     <NA>   <NA>  [1]       <NA>
KernSmooth   2.23-20   CRAN     <NA>   <NA>  [2]       <NA>
MASS          7.3-54   CRAN     <NA>   <NA>  [2]       <NA>
Matrix         1.3-4   CRAN     <NA>   <NA>  [2]       <NA>
R6             2.5.1   CRAN     <NA>   <NA>  [1]       <NA>
RColorBrewer   1.1-2   CRAN     <NA>   <NA>  [1]       <NA>
boot          1.3-28   CRAN     <NA>   <NA>  [2]       <NA>
class         7.3-19   CRAN     <NA>   <NA>  [2]       <NA>
cli            3.1.0   CRAN     <NA>   <NA>  [1]       <NA>
cluster        2.1.2   CRAN     <NA>   <NA>  [2]       <NA>
codetools     0.2-18   CRAN     <NA>   <NA>  [2]       <NA>
colorspace     2.0-2   CRAN     <NA>   <NA>  [1]       <NA>
crayon         1.4.2   CRAN     <NA>   <NA>  [1]       <NA>
data.table    1.14.2   CRAN     <NA>   <NA>  [1]       <NA>
digest        0.6.29   CRAN     <NA>   <NA>  [1]       <NA>
ellipsis       0.3.2   CRAN     <NA>   <NA>  [1]       <NA>
fansi          0.5.0   CRAN     <NA>   <NA>  [1]       <NA>
farver         2.1.0   CRAN     <NA>   <NA>  [1]       <NA>
foreign       0.8-81   CRAN     <NA>   <NA>  [2]       <NA>
ggplot2        3.3.5   CRAN     <NA>   <NA>  [1]       <NA>
glue           1.5.1   CRAN     <NA>   <NA>  [1]       <NA>
gtable         0.3.0   CRAN     <NA>   <NA>  [1]       <NA>
isoband        0.2.5   CRAN     <NA>   <NA>  [1]       <NA>
labeling       0.4.2   CRAN     <NA>   <NA>  [1]       <NA>
lattice      0.20-45   CRAN     <NA>   <NA>  [2]       <NA>
lifecycle      1.0.1   CRAN     <NA>   <NA>  [1]       <NA>
magrittr       2.0.1   CRAN     <NA>   <NA>  [1]       <NA>
mgcv          1.8-38   CRAN     <NA>   <NA>  [2]       <NA>
munsell        0.5.0   CRAN     <NA>   <NA>  [1]       <NA>
nlme         3.1-152   CRAN     <NA>   <NA>  [2]       <NA>
nnet          7.3-16   CRAN     <NA>   <NA>  [2]       <NA>
pillar         1.6.4   CRAN     <NA>   <NA>  [1]       <NA>
pkgconfig      2.0.3   CRAN     <NA>   <NA>  [1]       <NA>
renv          0.14.0   CRAN   0.14.0   CRAN  [1]     direct
rlang         0.4.12   CRAN     <NA>   <NA>  [1]       <NA>
rpart         4.1-15   CRAN     <NA>   <NA>  [2]       <NA>
scales         1.1.1   CRAN     <NA>   <NA>  [1]       <NA>
spatial       7.3-14   CRAN     <NA>   <NA>  [2]       <NA>
survival      3.2-13   CRAN     <NA>   <NA>  [2]       <NA>
tibble         3.1.6   CRAN     <NA>   <NA>  [1]       <NA>
utf8           1.2.2   CRAN     <NA>   <NA>  [1]       <NA>
utils           <NA>   <NA>     <NA>   <NA>  [2]   indirect
vctrs          0.3.8   CRAN     <NA>   <NA>  [1]       <NA>
viridisLite    0.4.0   CRAN     <NA>   <NA>  [1]       <NA>
withr          2.4.3   CRAN     <NA>   <NA>  [1]       <NA>

[1]: /home/mshenton/analysis/haplotype_graphics/renv/library/R-4.1/x86_64-pc-linux-gnu
[2]: /tmp/RtmpY1vtdW/renv-system-library                                              

# User Profile =======================
[no user profile detected]

# Settings ===========================
List of 8
 $ external.libraries       : chr(0) 
 $ ignored.packages         : chr(0) 
 $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo"
 $ r.version                : chr(0) 
 $ snapshot.type            : chr "implicit"
 $ use.cache                : logi TRUE
 $ vcs.ignore.library       : logi TRUE
 $ vcs.ignore.local         : logi TRUE

# Options ============================
List of 8
 $ defaultPackages                     : chr [1:6] "datasets" "utils" "grDevices" "graphics" ...
 $ download.file.method                : chr "libcurl"
 $ download.file.extra                 : NULL
 $ install.packages.compile.from.source: NULL
 $ pkgType                             : chr "source"
 $ repos                               : Named chr "https://cloud.r-project.org"
  ..- attr(*, "names")= chr "CRAN"
 $ renv.consent                        : logi TRUE
 $ renv.verbose                        : logi TRUE

# Environment Variables ==============
HOME                        = /home/mshenton
LANG                        = en_US.UTF-8
MAKE                        = make
R_LIBS                      = <NA>
R_LIBS_SITE                 = /usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
R_LIBS_USER                 = /home/mshenton/analysis/haplotype_graphics/renv/library/R-4.1/x86_64-pc-linux-gnu:/tmp/RtmpY1vtdW/renv-system-library
RENV_DEFAULT_R_ENVIRON      = <NA>
RENV_DEFAULT_R_ENVIRON_USER = <NA>
RENV_DEFAULT_R_LIBS         = <NA>
RENV_DEFAULT_R_LIBS_SITE    = /usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
RENV_DEFAULT_R_LIBS_USER    = ~/R/x86_64-pc-linux-gnu-library/4.1
RENV_DEFAULT_R_PROFILE      = <NA>
RENV_DEFAULT_R_PROFILE_USER = <NA>
RENV_PROJECT                = /home/mshenton/analysis/haplotype_graphics

# PATH ===============================
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
- /usr/lib/rstudio/bin/postback

# Cache ==============================
There are a total of 34 package(s) installed in the renv cache.
Cache path: "~/.cache/R/renv/cache/v5/R-4.1/x86_64-pc-linux-gnu"

Thanks for the bug report! Unfortunately, I'm not able to reproduce -- can you provide any other details? Do you have better luck if you set:

Sys.setenv(RENV_DOWNLOAD_FILE_METHOD = "libcurl")

before attempting the install?

2 Likes

The solution that seems to have worked is:

options(renv.download.override = utils::download.file)

Thanks

4 Likes

I have ran into a similar issue on Ubuntu 20.04.03. Feel free to read through my journey, or read what helped me at the bottom of this post.

Reproduction Steps

  1. Enter an empty directory
  2. Run R console
  3. Run renv::init()
  4. Restart R console
  5. Try installing a package:
    > renv::install("shiny")
    Error: package 'shiny' is not available
    In addition: Warning message:
    could not retrieve available packages for url 'https://cloud.r-project.org/src/contrib' 
    Traceback (most recent calls last):
    6: renv::install("shiny")
    5: retrieve(names(remotes))
    4: handler(package, renv_retrieve_impl(package))
    3: renv_retrieve_impl(package)
    2: stopf("package '%s' is not available", package)
    1: stop(sprintf(fmt, ...), call. = call.)
    

Session Info

> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=pl_PL.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=pl_PL.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=pl_PL.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=pl_PL.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.3 tools_4.1.3    renv_0.15.4 

What I Tried

In addition to any proposed solution in this thread I have tried:

  1. Changing R repository
  2. Removing ~/.cache/R/renv
  3. Removing ~/R , ~/.cache/R , and reinstalling R
  4. Using different R consoles (RStudio, R, radian)

I have tried running renv within Docker and seeing if it is an issue with connectivity. It turned out that renv works in both:

  • rocker/r-base Docker image
  • ubuntu:focal Docker image with manually installed R

What Helped

With renv working in Docker images mimicking my system and not in the system itself I have scanned for any oddities that I do have installed.

It turned out that Nix the package manager and some packages I had installed through it were at fault. Purging Nix and its packages did resolve the issue for me. I have done that by removing /nix and ~/.nix-profile (note: this step depends on the way you have installed Nix). I suspect there was some masking going on that caused this issue.

We had a pretty similar issue. However, what helped us was adding:

Sys.setenv(RENV_DOWNLOAD_FILE_METHOD = "libcurl") # 

in .RProfile so that the variable was set before activating renv:

# .RProfile
Sys.setenv(RENV_DOWNLOAD_FILE_METHOD = "libcurl")
source("renv/activate.R")
3 Likes

Thanks. This was useful to me too.:

options(renv.download.override = utils::download.file)

I couldn't make renv:::renv_download_file_method() work.

Thanks, this seems to be the most reliable method for me.

Note to myself, the .RProfile in the project directory was the one to edit

I had a similar issue.

This solution worked for me

Sys.setenv(RENV_DOWNLOAD_FILE_METHOD = "libcurl")

FYI:

> getOption("download.file.method")
[1] "wininet"
> renv:::renv_download_file_method()
Error: object 'renv_download_file_method' not found
> renv::diagnostics()
Diagnostics Report [renv 0.15.5]
================================

# Session Info =======================
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.2 tools_4.1.2    renv_0.15.5   

# Project ============================
Project path: "~/R_projects/integrated-adhesions"

# Status =============================
* The project is already synchronized with the lockfile.

# Packages ===========================
           Library Source Lockfile Source Path Dependency
KernSmooth 2.23-20   CRAN     <NA>   <NA>  [2]       <NA>
MASS        7.3-54   CRAN     <NA>   <NA>  [2]       <NA>
Matrix       1.3-4   CRAN     <NA>   <NA>  [2]       <NA>
boot        1.3-28   CRAN     <NA>   <NA>  [2]       <NA>
class       7.3-19   CRAN     <NA>   <NA>  [2]       <NA>
cluster      2.1.2   CRAN     <NA>   <NA>  [2]       <NA>
codetools   0.2-18   CRAN     <NA>   <NA>  [2]       <NA>
foreign     0.8-81   CRAN     <NA>   <NA>  [2]       <NA>
lattice    0.20-45   CRAN     <NA>   <NA>  [2]       <NA>
mgcv        1.8-38   CRAN     <NA>   <NA>  [2]       <NA>
nlme       3.1-153   CRAN     <NA>   <NA>  [2]       <NA>
nnet        7.3-16   CRAN     <NA>   <NA>  [2]       <NA>
renv        0.15.5   CRAN   0.15.5   CRAN  [1]     direct
rpart       4.1-15   CRAN     <NA>   <NA>  [2]       <NA>
spatial     7.3-14   CRAN     <NA>   <NA>  [2]       <NA>
survival    3.2-13   CRAN     <NA>   <NA>  [2]       <NA>
utils         <NA>   <NA>     <NA>   <NA>  [2]   indirect

[1]: C:/Users/darkc/Documents/R_projects/integrated-adhesions/renv/library/R-4.1/x86_64-w64-mingw32
[2]: C:/Program Files/R/R-4.1.2/library                                                            

# ABI ================================
* ABI conflict checks are not yet implemented on Windows.

# User Profile =======================
[1] Source  Package Require Version Dev    
<0 rows> (or 0-length row.names)

# Settings ===========================
List of 10
 $ bioconductor.version     : chr(0) 
 $ external.libraries       : chr(0) 
 $ ignored.packages         : chr(0) 
 $ package.dependency.fields: chr [1:3] "Imports" "Depends" "LinkingTo"
 $ r.version                : chr(0) 
 $ snapshot.type            : chr "implicit"
 $ use.cache                : logi TRUE
 $ vcs.ignore.cellar        : logi TRUE
 $ vcs.ignore.library       : logi TRUE
 $ vcs.ignore.local         : logi TRUE

# Options ============================
List of 9
 $ defaultPackages                     : chr [1:6] "datasets" "utils" "grDevices" "graphics" ...
 $ download.file.method                : chr "wininet"
 $ download.file.extra                 : NULL
 $ install.packages.compile.from.source: chr "interactive"
 $ pkgType                             : chr "both"
 $ repos                               : Named chr "https://cran.rstudio.com"
  ..- attr(*, "names")= chr "CRAN"
 $ renv.consent                        : logi TRUE
 $ renv.project.path                   : chr "C:/Users/darkc/Documents/R_projects/integrated-adhesions"
 $ renv.verbose                        : logi TRUE

# Environment Variables ==============
HOME                        = C:/Users/darkc/Documents
LANG                        = <NA>
MAKE                        = <NA>
R_LIBS                      = <NA>
R_LIBS_SITE                 = <NA>
R_LIBS_USER                 = C:/Users/darkc/Documents/R_projects/integrated-adhesions/renv/library/R-4.1/x86_64-w64-mingw32;C:/Program Files/R/R-4.1.2/library
RENV_DEFAULT_R_ENVIRON      = <NA>
RENV_DEFAULT_R_ENVIRON_USER = <NA>
RENV_DEFAULT_R_LIBS         = <NA>
RENV_DEFAULT_R_LIBS_SITE    = <NA>
RENV_DEFAULT_R_LIBS_USER    = C:/Users/darkc/Documents/R/win-library/4.1
RENV_DEFAULT_R_PROFILE      = <NA>
RENV_DEFAULT_R_PROFILE_USER = <NA>
RENV_PROJECT                = C:/Users/darkc/Documents/R_projects/integrated-adhesions

# PATH ===============================
- C:\Program Files\R\R-4.1.2\bin\x64
- C:\Program Files\R\R-4.1.2\bin\x64
- C:\Program Files\copasi.org\COPASI 4.35.258\bin
- C:\Windows\system32
- C:\Windows
- C:\Windows\System32\Wbem
- C:\Windows\System32\WindowsPowerShell\v1.0\
- C:\Windows\System32\OpenSSH\
- C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
- C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
- C:\WINDOWS\system32
- C:\WINDOWS
- C:\WINDOWS\System32\Wbem
- C:\WINDOWS\System32\WindowsPowerShell\v1.0\
- C:\WINDOWS\System32\OpenSSH\
- C:\rtools40\usr\bin
- C:\Program Files (x86)\dotnet\
- C:\Program Files\dotnet\
- C:\Program Files\Git\cmd
- C:\Users\darkc\AppData\Local\Microsoft\WindowsApps
- C:\Users\darkc\AppData\Local\GitHubDesktop\bin

# Cache ==============================
There are a total of 0 package(s) installed in the renv cache.
Cache path: "C:/Users/darkc/AppData/Local/R/cache/R/renv/cache/v5/R-4.1/x86_64-w64-mingw32"
2 Likes

Use renv:::renv_download_method() instead.

If you're still having issues with this, try the following:

  1. Insert the following code to your .Rprofile file: options(renv.download.override = utils::download.file).
  2. Certify that renv is activated (renv::activate()).
    2.1 (optional) Delete all packages, except for renv, installed in ./renv/library.
  3. Reinstall renv with its dependencies with utils::install.packages("renv", dependencies = TRUE).
  4. Restart R (.rs.restartR()).
  5. Try to install a package using renv::install() (e.g., renv::install("dplyr")).

Also, don't forget to read renv's _ Alternative downloaders_ section: https://rstudio.github.io/renv/articles/package-install.html#alternative-downloaders.

I had similar issues.

Finally I realized that renv seems to change the repos.
Which seemed to affect utils::download.file.
Unfortunately my employer blocked all repos except rstudio.com, https is also blocked.

In my case following helped:
options(repos="http://cran.rstudio.com/")
Sys.setenv("RENV_CONFIG_REPOS_OVERRIDE" = "http://cran.rstudio.com")

See also: How to change R repository CRAN from renv.lock to get packages from an internal/corporate repository? - Stack Overflow