2

I had posted a few days earlier about issues in installing packages in RStudio here - RStudio Package installation error. However, my question was marked as duplicate, assuming that the solution posted in the comments is actually the best solution.

Although I have the exact same problem as already mentioned, that solution posted by Ian doesn't help. In fact I get a new kind of error. Please see below:

Warning in install.packages :
  unable to connect to 'cran.rstudio.com' on port 80.
Warning in install.packages :
  unable to connect to 'cran.rstudio.com' on port 80.
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.1
Warning in install.packages :
unable to connect to 'www.stats.ox.ac.uk' on port 80.
Warning in install.packages :
unable to connect to 'www.stats.ox.ac.uk' on port 80.
Warning in install.packages :
unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.1
Installing package into ‘C:/Users/avi/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
DSkoog
  • 657
  • 5
  • 12
access_nash
  • 35
  • 1
  • 5
  • Do you get the same error when you try to install packages directly through `R`? – Steven Jan 15 '15 at 15:53
  • Those are not errors, they are warnings. With warnings, operations still go on. Did you check the install? **Installing package into ‘C:/Users/avi/Documents/R/win-library/3.1’** looks promising. Did you check the contents of that folder? – Rich Scriven Jan 15 '15 at 16:04
  • But if the package was installed, I should get some message showing the success, right? I'm new to R and I don't have much idea.....Let me check what you mentioned.....Btw, it's really late here and I need to get back early to office tomorrow morning. I'll get back to you on this – access_nash Jan 15 '15 at 16:08
  • There's none of the packages in the folder. Just another folder "manipulate" – access_nash Jan 17 '15 at 11:36
  • I would use something like a tcping to see if you can connect to those machines and ports. Like this one: http://www.elifulkerson.com/projects/tcping.php – Mike Wise Jan 12 '17 at 10:25

4 Answers4

1

It looks like a connection issue, rather than an installation issue. If you work in an organisation - such as a university - and are behind their firewall it could, for example, be a proxy issue.

Two workarounds (as I'm not a network specialist):

  • If you can move your data to a personal computer (i.e. no encryption/data protection issues) try installing R and RStudio on another computer and see if you can install packages (preferably using a different internet connection, e.g. from your home).
  • You can install packages from source, so you could download the package and install without needing a connection in RStudio. See, for example, this post: How do I install an R package from source?

If these do not help, additional information that would be helpful for others would be a list of the package(S) you're trying to install, where you're trying to connect from and if that has a firewall, and how you're trying to install packages (i.e. what commands are you typing). Additionally, your organisation/institution computer services might be able to help.

Good luck.

Community
  • 1
  • 1
Phil
  • 4,344
  • 2
  • 23
  • 33
  • Hi Phil, thanks for your response. I'm using this on a personal computer from home. I'm trying to install "devtools" and also checked by trying "rpart" and "KernSmooth". And I'm installing using > install.packages("devtools") – access_nash Jan 15 '15 at 16:02
  • Ok, that probably eliminates a potential proxy issue. Have you tried installing your packages from a source file (i.e. download the file locally and install from there)? – Phil Jan 16 '15 at 10:29
  • Will try that. I had seen a message on some website - _if your installation gives you unable to connect to 'cran.r-project.org' on port 80. simply type setInternet2() chooseCRANmirror()_ if i do that, i'm getting a new error - _[1] FALSE Warning message: In setInternet2() : internet routines were already initialized > chooseCRANmirror()_ After this there's a list of countries. So choose my current location? – access_nash Jan 16 '15 at 15:36
  • 1
    I'm sorry, I don't think I can help further. If you've tried the solutions suggested - https://support.rstudio.com/hc/communities/public/questions/200522573-Can-t-install-packages - and it still doesn't work I'm fresh out of ideas. I'll leave my answer so these comments are preserved in case someone else can help. – Phil Jan 18 '15 at 08:51
  • Never mind...I hadn't changed anything all this while. I just tried again to install the packages (devtools, KernSmooth) and everything worked fine. No errors! – access_nash Jan 26 '15 at 13:39
0

I have seen this problem on corporate networks where this access method is blocked. One solution is to try RStudio as it uses a different method to install packages and may work for your case.

RDB57
  • 11
  • 1
0

Do these steps : Tools -> Global Options -> Packages and uncheck the "Use Internet Explorer library/proxy for HTTP". Restart R ,and it should work

Shalini Baranwal
  • 2,780
  • 4
  • 24
  • 34
0

I've had a similar error. That's what I did to fix it:

  1. Tried to install RODBC -> install.packages("RODBC")
  2. Got a failed to connect to 'cran.r-project.org' on port 80." error message
  3. Used the setInternet2(TRUE) command to force it to use my Internet Explorer proxy config
  4. You can check if the command has worked by typing setInternet2(NA). If it returns [1] TRUE, it's working
  5. In some cases, that should be enough (just run the install.packages again). For me, it wasn't (my proxy server requires a password)
  6. The error that I got after trying to run the install.packages was 407 Proxy Authentication Required
  7. To get rid of this last error message, I had to manually configure my proxy credentials. For that, you will need to run Sys.setenv( "http_proxy"="http://<username>:<password>@<proxy-host>:<port>" ) a real life code should look like this one Sys.setenv( "http_proxy"="http://user:password@192.127.100.32:80" )
  8. After that, I tried to install my packages again end it worked perfectly.

If you can't make it work even after that, you can still download the package using your browser and install it locally.

install.packages( file.choose(), repos=NULL )

The file.choose() will prompt you for the name of the downloaded package file.

This link helped me A LOT with this soluction.

Oliver Drummond
  • 680
  • 1
  • 6
  • 19