[R] Problems installing packages using the inbuilt facility: "Error i n gzfile(file, "r") : unable to open connection"
Henrik Bengtsson
hb at stat.berkeley.edu
Sat Mar 8 00:46:31 CET 2008
Works fine for me on the same setup. Try this and compare (especially
the size of the downloaded file):
> url <- "http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip";
> download.file(url, basename(url), mode="wb") # Note "wb"!!!
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
> file.info(basename(url))
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
> install.packages(basename(url), repos=NULL)
package 'ada' successfully unpacked and MD5 sums checked
updating HTML package descriptions
> library(ada)
Loading required package: rpart
>
/Henrik
On Fri, Mar 7, 2008 at 10:02 AM, Kauer, Philipp
<philipp.kauer at credit-suisse.com> wrote:
> Hi
>
> I have been trawling the web, FAQs, and R manuals for help on the following issue, but have failed and was wondering if anyone has a solution to the following problem:
>
> After having installed R 2.6.2 for Windows (binary), I tried to install various packages. Every time I try loading a package (any package) via the built-in menu, I run into the following error message.
>
> > utils:::menuInstallPkgs()
> trying URL 'http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip <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
>
> Warning in gzfile(file, "r") :
> cannot open compressed file 'ada/DESCRIPTION', probable reason 'No such file or directory'
> Error in gzfile(file, "r") : unable to open connection
> > traceback()
> 6: gzfile(file, "r")
> 5: read.dcf(file.path(curPkg, "DESCRIPTION"), c("Package", "Version",
> "Type"))
> 4: unpackPkg(foundpkgs[okp, 2], foundpkgs[okp, 1], lib, installWithVers)
> 3: .install.winbinary(pkgs = pkgs, lib = lib, contriburl = contriburl,
> method = method, available = available, destdir = destdir,
> installWithVers = installWithVers, dependencies = dependencies)
> 2: install.packages(NULL, .libPaths()[1], dependencies = NA, type = type)
> 1: utils:::menuInstallPkgs()
>
> I tried saving the ZIP of the package to my C drive, and then installing from that, but I get the same error message. I then tried calling gzfile with the filename of the ZIP directly, and I seem to get a file handle without any error message:
>
> gzfile("C:/Program Files/R/R-2.6.2/library/ada_2.0-1.zip","r")
> description class
> "C:/Program Files/R/R-2.6.2/library/ada_2.0-1.zip" "gzfile"
> mode text
> "rb6" "binary"
> opened can read
> "opened" "yes"
> can write
> "no"
>
>
>
> It might be worth noting, that I initially I also had problems with the internet download facility, which I fixed starting R with the flag --internet2, as indicated in the FAQs.
>
> Can you please help?
>
> Many thanks - Philipp
>
> PS: I did the same on my PC at home, and there everything works without problems.
>
>
> ==============================================================================
> Please access the attached hyperlink for an important el...{{dropped:8}}
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list