This is my first post in the stack though this has been my go to option for any coding related issue for a long time. So recently my machine was reconfigured and I had to reinstall with the IT support all my IDEs including R and RStudio. Since then I am getting this vexing issue of installing any new R package and even existing R packages keep throwing error that it's not installed or can't connect to CRAN mirror
> .libPaths()
[1] "H:/My Documents/R/R-3.3.2" "H:/My Documents/R/R-3.3.2/library" "C:/R/R-3.5.3/library"
> .libPaths("C:/R/R-3.5.3/library")
> install.packages("DBI",repos="https://cran.rstudio.com/")
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
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 :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
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 ‘DBI’ is not available (for R version 3.5.3)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
I saw this was posted in another thread here:
R - cannot access urls for package installation
I tried all recommendations in here, still couldn't get it fixed. Any idea what else could be broken. Much appreciate your reponse. BTW, I am not an R pro either, just a little bit hands on.
I try to install dplyr package using command install.packages("dplyr"). I get following error. Could anyone identify what is the issue here? Am I missing someting?
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
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/mani/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
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 ‘dplyr’ is not available (for R version 3.4.0)
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
Warning in install.packages :
InternetOpenUrl failed: ' âˆû'
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.4:
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.4/PACKAGES'
I have a problem to install package 'swirl' on my Rstudio. I tried several cran in China and it cannot connect to server every time. Does anyone know any possible reason? *ps:since the stackoverflow does not allow me to post more than one URL link so I cut off a 'h' of from 'http'
install.packages("swirl")
Warning in install.packages :
URL
'http://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES.rds':
status was 'Couldn't connect to server' Warning in install.packages :
URL 'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES.gz':
status was 'Couldn't connect to server' Warning in install.packages :
URL 'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES':
status was 'Couldn't connect to server' Warning in install.packages :
unable to access index for repository
ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib: cannot open URL
'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES' Warning
in install.packages : URL
'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES.rds':
status was 'Couldn't connect to server' Warning in install.packages :
URL 'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES.gz':
status was 'Couldn't connect to server' Warning in install.packages :
URL 'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES':
status was 'Couldn't connect to server' Warning in install.packages :
unable to access index for repository
ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib: cannot open URL
'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/PACKAGES' Warning
in install.packages : package 'swirl' is not available (for R
version 3.4.0) Warning in install.packages : URL
'ttp://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/macosx/el-capitan/contrib/3.4/PACKAGES.rds':
status was 'Couldn't connect to server'
Try:
install.packages("swirl", repos="http://cran.rstudio.com/", dependencies=TRUE)
I have trouble with installing packages from internet:
> install.packages("qualV")
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://mirror.ibcp.fr/pub/CRAN/src/contrib
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://mirror.ibcp.fr/pub/CRAN/src/contrib
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib
Warning in install.packages :
package ‘qualV’ is not available (for R version 3.2.2)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://mirror.ibcp.fr/pub/CRAN/bin/windows/contrib/3.2
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2
I've checked the repositories, proxy and set debug info:
> options(internet.info = 0)
> options()$repos
CRAN CRANextra
"https://mirror.ibcp.fr/pub/CRAN/" "http://www.stats.ox.ac.uk/pub/RWin"
attr(,"RStudio")
[1] TRUE
>
> Sys.getenv("http_proxy")
[1] ""
> Sys.getenv("https_proxy")
[1] ""
I've unchecked: R-studio->Tools->Global Options->Use Internet Explorer library/proxy for HTTP (I've also tried pure R without R-studio with same results)
Seems the problem is with internet access:
> url.link <- "https://stat.ethz.ch/R-manual/R-devel/library/utils/html/download.file.html"
> content <- download.file(url.link, destfile = "download.file.html")
trying URL 'https://stat.ethz.ch/R-manual/R-devel/library/utils/html/download.file.html'
Error in download.file(url.link, destfile = "download.file.html") :
cannot open URL 'https://stat.ethz.ch/R-manual/R-devel/library/utils/html/download.file.html'
In addition: Warning message:
In download.file(url.link, destfile = "download.file.html") :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Here comes interesting part, seems that the problem is not with internet access:
> library(RCurl)
> content <- getURL(url.link)
> nchar(content)
[1] 13537
Why install.packages and download.file aren't working while getURL is working?
PS: OS is Windows 7 running on corporate notebook so there are AV/FW installed that I cannot disable (I'm not admininstrator).
This is a guess.
I think you have a new version of RStudio but an old version of R. In my experience you can install the package if you just use R, i.e. not through RStudio. I would recommend updating both R and RStudio to the latest versions.
I think the issue arises because RStudio enforces https, which is only introduced in a later version of R.
I recently installed R Studio (Version 0.99.892) on a personal computer (windows 8) and am trying to install, among others, the following packages:
ggplot2;
dplyr;
rmarkdown;
tidyr.
Neither R nor R Studio is able to install any of these packages. Each time I attempt to install a package, I get the set of warnings I include at the bottom of this post.
I have used the install.packages command as well as the built-in package installation tool. I have tried several different mirrors.
I have tried a public university internet source, my own private internet source, and a phone tether. I have tried to connect through a VPN. I have added R Studio to my Windows Firewall exception list and have also completely disabled the Windows Firewall. I am running no other firewalls.
I have toggled the various connection options in the "Packages" tab in Global Options.
I can access the URLs in a browser.
Here are the warnings from R Studio:
> install.packages("devtools")
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/src/contrib:
cannot open URL 'https://cran.fhcrc.org/src/contrib/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Installing package into ‘C:/Users/Nikhailovich/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/src/contrib:
cannot open URL 'https://cran.fhcrc.org/src/contrib/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning in install.packages :
package ‘devtools’ is not available (for R version 3.2.3)
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository https://cran.fhcrc.org/bin/windows/contrib/3.2:
cannot open URL 'https://cran.fhcrc.org/bin/windows/contrib/3.2/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/PACKAGES'
Here are the warnings from R (3.2.3):
> install.packages("ggplot2")
Installing package into ‘C:/Users/Nikhailovich/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning: unable to access index for repository https://dirichlet.mat.puc.cl/src/contrib:
cannot open URL 'https://dirichlet.mat.puc.cl/src/contrib/PACKAGES'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning: unable to access index for repository https://dirichlet.mat.puc.cl/bin/windows/contrib/3.2:
cannot open URL 'https://dirichlet.mat.puc.cl/bin/windows/contrib/3.2/PACKAGES'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/PACKAGES'
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.3)
There are several stackexchange posts on package installation in R and R Studio, but I was not able to find any that answered my particular situation. Thanks in advance to anyone that knows what's going on
Run this command:
options(repos="https://CRAN.R-project.org")
after that try install.packages;it should work.Tested on my system.
This has happened to me before. Try explicitly specifying the location:
install.packages("devtools", repos="https://cran.rstudio.com/")
You can indeed specify the location when using the install.packages() function with the argument repos=, but you can also choose your favorite repository which will be used each time you download a package.
options(repos="my_favorite_CRAN_mirror")
You can see a list of all availables mirrors on the CRAN website. Juste copy/paste the adress of the closest CRAN repository to you.
You should be able after this step to retry install.packages('ggplot2')
You should try following code:
install.packages("ggbiplot",dependencies = TRUE, repos = 'http://cran.rstudio.com/')
It will help you to install the packages for the error:
package is not available for this version
Run the following command in R terminal-
options(repos="https://CRAN.R-project.org")
then-
use-install.packages('library')
I want to add that I had this issue, but the fix was not in R, but in our system. Our IT guy said: For some unknown reason, the DNS resolver service was unable to resolve hostnames. I’ve restarted the resolvd service. The server can now resolve hostnames.
The error on his end was: Temporary failure in name resolution
I was having a similar error while trying to install the packages dplyr, tidyr packages.
I solved the issue by checking my R.version and downloading a new version of base R. (3.3.3)
Try this...
Tools-->Global Option--> Package
Change "Primary CRAN Repository" to htpps Location
This method fixed my issue