R package installation issues

hlsmith

Not a robit
#1
I have been having connectivity or firewall or something iissues when trying to install.packages. I believe the former, because eventually it goes through. Does the ".ox.ac.uk" portion mean it is trying to download from UK? I am in central United States. I ran the following code and it seem to do it as well. But eventually it tells me I have dependency issues related to versions, but I get the same scenario when installing other packages without version dependency issues. Any suggestions? I am going to try to reset my CRAN mirror.




WHAT IS COMING UP IN MY CONSOLE:
> install.packages("arule", repo="<your.nearest.mirror>")
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
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 :
unable to access index for repository <your.nearest.mirror>/src/contrib:
scheme not supported in URL '<your.nearest.mirror>/src/contrib/PACKAGES'
Warning in install.packages :
package ‘arule’ is not available (for R version 3.4.3)
Warning in install.packages :
unable to access index for repository <your.nearest.mirror>/bin/windows/contrib/3.4:
scheme not supported in URL '<your.nearest.mirror>/bin/windows/contrib/3.4/PACKAGES'
 

hlsmith

Not a robit
#2
Another basic example where I try to reinstall Hmisc:

> install.packages("Hmisc")
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
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 :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
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 :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES'
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/Hmisc_4.1-1.zip'
Content type 'application/zip' length 1818838 bytes (1.7 MB)
downloaded 1.7 MB

package ‘Hmisc’ successfully unpacked and MD5 sums checked
 

hlsmith

Not a robit
#3
Well I updated my mirror and that did not seem to help?? Any suggestions, seems like a network issue perhaps.

> install.packages("Hmisc")
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 https://mirror.las.iastate.edu/CRAN/src/contrib:
cannot open URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/PACKAGES'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
InternetOpenUrl failed: 'A connection with the server could not be established'
 

hlsmith

Not a robit
#5
I did it two different ways:

1.) In RStudio, I click on Tools -> Global Setting -> Packages and selected Iowa State.
2.) I ran some snippet of code I found online? It listed mirrors and I selected #56 Iowa State.
I have since open and closed R a couple of times, so I don't have that code anymore, something like:
chooseC56RANmirror(56)

Here is another example of a failed install, what is up with the line I colored blue?:
> install.packages("Hmisc")
Warning in install.packages :
unable to access index for repository https://mirror.las.iastate.edu/CRAN/src/contrib:
cannot open URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/PACKAGES'
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 :
unable to access index for repository https://mirror.las.iastate.edu/CRAN/src/contrib:
cannot open URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/PACKAGES'
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 ‘Hmisc’ is not available (for R version 3.4.3)
Warning in install.packages :
unable to access index for repository https://mirror.las.iastate.edu/CRAN/bin/windows/contrib/3.4:
cannot open URL 'https://mirror.las.iastate.edu/CRAN/bin/windows/contrib/3.4/PACKAGES'
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES'
 

hlsmith

Not a robit
#7
I had tried that and got the same error using RGui for an older install I had on my machine. I got same looking Warning!




> install.packages("Hmisc")
Installing package into ‘C:/Users/smithhl/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository https://mirror.las.iastate.edu/CRAN/src/contrib:
cannot open URL 'https://mirror.las.iastate.edu/CRAN/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://mirror.las.iastate.edu/CRAN/bin/windows/contrib/3.3:
cannot open URL 'https://mirror.las.iastate.edu/CRAN/bin/windows/contrib/3.3/PACKAGES'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.3:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.3/PACKAGES'
Warning message:
package ‘Hmisc’ is not available (for R version 3.3.2)
 

Dason

Ambassador to the humans
#9
Do you have RCurl installed? If so what does this give:
Code:
is.character(RCurl::getURL("www.google.com"))
if not what does the following give
Code:
havingIP <- function() {
if (.Platform$OS.type == "windows") {
ipmessage <- system("ipconfig", intern = TRUE)
} else {
ipmessage <- system("ifconfig", intern = TRUE)
}
validIP <- "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.]){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
any(grep(validIP, ipmessage))
}
havingIP()
 
#11
It is weird that I got the package "ada" to load earlier, but it took quit awhile (connection attempts) and that was before I changed the mirror. I keep wondering if this is some weird administrative setting thing, but 'ada' loaded earlier. But nothing since and it keeps telling my that a package isn't available for the R version, after multiple connection attempts.
 
#12
AwwwwwwwHHHHHHHHHHHHHH. Half a day gone, I just reinstall R and it still doesn't work, but now with the reinstall I lost all previous packages I had installed, so I now have the bare bones plus still the connection issue.

"R is free software and comes with ABSOLUTELY NO WARRANTY." awwwww.
 
#13
Is there a work around not to install the packages directly from CRAN mirror, say download them and then install them from my machine.

Any recommendations at all?
 

Dason

Ambassador to the humans
#15
So I could get some files via:

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/knitr_1.20.zip'
Content type 'application/zip' length 916480 bytes (895 KB)
downloaded 895 KB

Is this a work around, but not everything I need is on that site, say "ada" and it seem wonky just tracking down Repos.
It sounds like you might have a firewall or internet issue going on. But you can just download the packages directly from the parent of that page: https://cran.rstudio.com/bin/windows/contrib/3.4 . The annoying part for you will be that you'll apparently have to do the dependency installations by hand and those can run kind of keep. "ada" is on there but the sorting might not be what you expect since it is case-sensitive and the lower case comes after the upper case so just do a ctrl-f to search for 'ada'.

Do you have any IT person that can you help you directly?
 
Last edited:
#16
Do you have admin rights on your machine? I have had problems with that for some packages in the past, where my institute blocked some functionalities of RStudio. I need to run RStudio as administrator to install some packages.