Skip to content
Prev 139057 / 398506 Next

Problems installing packages using the inbuilt facility: "Error i n gzfile(file, "r") : unable to open connection"

Thank you Henrik for your response. 

As I indicated at the end of my e-mail, I only have this problem at work, and was not be able to replicate it at home (ie packages load fine there). I followed the steps you suggested, but unfortunately no luck (below is the output). Essentially, the error messages are the same to the one shown in my initial e-mail. 

I noticed that Bob Green posted a very similar request on Friday, when he had problems performing 'update packages' on a new install of 2.6.2 on Windows XP, and it was suggested that some things in the startup directories were not working. After some further investigation, I noticed that various packages that I instruct to load in my site Rprofile(I am upgrading from an older version of R), were not loading properly either, and after removing them, AND using the --internet2 option, the problem disappeared. 

To recap for anyone else who is experiencing a similar problem: Try starting R with the option --internet2 (to get rid of any problems with -open.connection(con, "r") : unable to resolve 'cran.r-project.org' etc), and remove any packages in the site and local Rprofile, which do not load properly (that seemed to fix the problems experienced with gzfile).

Regards - Philipp
trying URL 'http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip'
Error in download.file(url, basename(url), mode = "wb") : 
  cannot open URL 'http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip'
In addition: Warning message:
In download.file(url, basename(url), mode = "wb") :
  unable to resolve 'cran.uk.r-project.org'
size isdir mode               mtime               ctime               atime exe
ada_2.0-1.zip    0 FALSE  666 2008-03-10 08:31:16 2008-03-10 08:20:53 2008-03-10 08:20:53  no
Error in gzfile(file, "r") : unable to open connection
In addition: Warning messages:
1: In zip.unpack(pkg, tmpDir) : error 1 in extracting from zip file
2: In gzfile(file, "r") :
  cannot open compressed file 'ada/DESCRIPTION', probable reason 'No such file or directory'




-----Original Message-----
From: henrik.bengtsson at gmail.com [mailto:henrik.bengtsson at gmail.com] On Behalf Of Henrik Bengtsson
Sent: 07 March 2008 23:47
To: Kauer, Philipp
Cc: r-help at lists.R-project.org
Subject: Re: [R] Problems installing packages using the inbuilt facility: "Error i n gzfile(file, "r") : unable to open connection"

Works fine for me on the same setup.  Try this and compare (especially the size of the downloaded file):
trying URL 'http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip'
Content type 'application/zip' length 971893 bytes (949 Kb) opened URL downloaded 949 Kb
size isdir mode               mtime               ctime
ada_2.0-1.zip 971893 FALSE  666 2008-03-07 15:43:52 2008-03-07 15:43:28
                            atime exe
ada_2.0-1.zip 2008-03-07 15:43:52  no
package 'ada' successfully unpacked and MD5 sums checked updating HTML package descriptions
Loading required package: rpart
/Henrik
On Fri, Mar 7, 2008 at 10:02 AM, Kauer, Philipp <philipp.kauer at credit-suisse.com> wrote:
==============================================================================
Please access the attached hyperlink for an important el...{{dropped:5}}