If you are unable to install packages issue in R Studio, and facing any of the below mentioned error, you have landed on the right page:
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/src/contrib:
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
package ‘PACKAGE NAME’ is not available (for R version 3.6.0)
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/3.6:
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/PACKAGES'
Solution:
Solution 1: Use R code to solve install.package()
Use below command before using install.packages(“PACKAGE NAME”)
options(repos = c(CRAN = “http://cran.rstudio.com”))
install.packages("package name")
Solution 2: Use RStudio
Changing the configuration in R Studio to solve install packages issue.
Go To Tools -> Global option -> Packages. Then uncheck the option “Use secure download method for HTTP”.
For other RStudio issues refer to official Troubleshooting Guide here.
Conclusion
I certainly hope that this guide will help people spend less time figuring about package install debugging and leave more time for data analysis and development.
Start your Data Science Journey here.
Greetings! Ꮩery helpful advice within this post! It’s the little
changes that wiⅼl make the most important changes.
Many thanks for sharing!
still unable to install any package on Rstudio. R version4.2.1.
> install.packages(“swirl”)
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL ‘http://cran.rstudio.com/src/contrib/PACKAGES’
Installing package into ‘C:/Users/Alka/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL ‘http://cran.rstudio.com/src/contrib/PACKAGES’
Warning in install.packages :
package ‘swirl’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/4.2:
cannot open URL ‘http://cran.rstudio.com/bin/windows/contrib/4.2/PACKAGES’
Do you know why this needs to be done? it is working fine now – thanks for the help. But may I know the reason behind it?
Option 2 worked for me. When I re-enabled secure (HTTPS) downloads, I got the following message in my RStudio console, which suggests something about the certs on my machine:
You are configured to use the CRAN mirror at https://cran.rstudio.com/. This mirror supports secure (HTTPS) downloads however your system is unable to communicate securely with the server (possibly due to out of date certificate files on your system). Falling back to using insecure URL for this mirror.
To learn more and/or disable this warning message see the “Use secure download method for HTTP” option in Tools -> Global Options -> Packages.
Thank you so much! It solved my problem.
I did try everything: Below is what I am running:
options(repos=”http://cran.rstudio.com”)
install.packages(‘tidyverse’, dependencies=TRUE)
I get the below error:
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL ‘http://cran.rstudio.com/src/contrib/PACKAGES’
Installing package into ‘C:/Users/1030780/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL ‘http://cran.rstudio.com/src/contrib/PACKAGES’
Warning in install.packages :
package ‘tidyverse’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/4.2:
cannot open URL ‘http://cran.rstudio.com/bin/windows/contrib/4.2/PACKAGES’
Thanks +1