Can not install packages after initializing renv

Hi guys,

I am new into R, before I worked a lot with Python and saw the advantages of using environments in projects, now I would like to use "renv" in R, but I ran into some problems:

It starts with installing a package, for example install.packages("dplyr"), that works for me.
After initializing the environment with renv::init(), all seems to work as well.

Now I wanted to see, how to add a package to this empty environment. When I try to install again, using install.packages("dplyr"), I am getting the following message:

Error: package 'dplyr' is not available
In addition: Warning messages:
1: could not retrieve available packages for url "https://cran.rstudio.com/src/contrib"
2: could not retrieve available packages for url "https://cran.rstudio.com/bin/windows/contrib/4.0"
3: curl: (28) Connection timed out after 20000 milliseconds

Have someone faced similar problems?

I have read some posts and tried out different things, but I can not solve this anyways.

Using getOption("download.file.method") has the output "wininet".

After deactivating renv, all works fine.

I suspect you need to force renv to use the wininet downloader. You can do so with:

Sys.setenv(RENV_DOWNLOAD_FILE_METHOD = "wininet")

If that works, you can set that as the default download method by placing:

RENV_DOWNLOAD_FILE_METHOD = "wininet"

in your ~/.Renviron. See ?Startup for more details.

1 Like

This topic was automatically closed 21 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.