[R] R 3.0.3, Windows 7: Problem installing XML package

Frede Aakmann Tøgersen frtog at vestas.com
Mon Apr 21 08:01:17 CEST 2014


Well now, I think I have seen something similar to Alpesh.

Recently I needed the climatol package that I have used some time ago. It is not maintained anymore but I downloaded the latest version, climatol_2.2.tar.gz,  from archives (http://cran.r-project.org/src/contrib/Archive/climatol/climatol_2.2.tar.gz ) . Trying to install that package from local file  using R-3.1.0 on Windows 8  resulted in this:

## From R Console
> utils:::menuInstallLocal()
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
  cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
  cannot open compressed file 'climatol_2.2.tar.gz/DESCRIPTION', probable reason 'No such file or directory'
>

And yes I know where the file is located, since choose.files() is used.

However I tried the same on our linux (R-3.0.2) cluster and it succeeded:

[frtog at dkrdsfshn2 ~]$ R CMD INSTALL climatol_2.2.tar.gz
* installing to library ?/gpfs02/gcdistro/app/R/3.0.2-gcc4.8.2/lib64/R/library?
* installing *source* package ?climatol? ...
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (climatol)
[frtog at dkrdsfshn2 ~]$ R

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library("climatol")
> ?rosavent
> q()
Save workspace image? [y/n/c]: n
[frtog at dkrdsfshn2 ~]$


Now unzipping and untaring climatol_2.2.tar.gz I thought to examine whether I could build the package on my Windows box. Only R stuff and no foreign language as C, FORTRAN, etc. so it should be easy.

## Command shell in Windows
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\frtog>cd Desktop

C:\Users\frtog\Desktop>c:\Programmer\R\R-3.1.0\bin\x64\R CMD build climatol
* checking for file 'climatol/DESCRIPTION' ... OK
* preparing 'climatol':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'climatol_2.2.tar.gz'

Now trying to install from that local file I Still got the same error as above.



Trying to do some debugging on read.dcf() (Emacs/ESS)


R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> > options(chmhelp=FALSE, help_type="text")
> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient.exe', show.error.locations=TRUE)
> debug(read.dcf)
> install.packages("~/Desktop/climatol_2.2.tar.gz", repos = NULL)
debugging in: read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type"))
debug: {
    if (is.character(file)) {
        file <- gzfile(file)
        on.exit(close(file))
    }
    if (!inherits(file, "connection"))
        stop("'file' must be a character string or connection")
    if (!all)
        return(.Internal(readDCF(file, fields, keep.white)))
    .assemble_things_into_a_data_frame <- function(tags, vals,
        nums) {
        tf <- factor(tags, levels = unique(tags))
        cnts <- table(nums, tf)
        out <- array(NA_character_, dim = dim(cnts), dimnames = list(NULL,
            levels(tf)))
        if (all(cnts <= 1L)) {
            out[cbind(nums, tf)] <- vals
            out <- as.data.frame(out, stringsAsFactors = FALSE)
        }
        else {
            levs <- colSums(cnts > 1L) == 0L
            if (any(levs)) {
                inds <- tf %in% levels(tf)[levs]
                out[cbind(nums[inds], tf[inds])] <- vals[inds]
            }
            out <- as.data.frame(out, stringsAsFactors = FALSE)
            for (l in levels(tf)[!levs]) {
                out[[l]] <- rep.int(list(NA_character_), nrow(cnts))
                i <- tf == l
                out[[l]][unique(nums[i])] <- split(vals[i], nums[i])
            }
        }
        out
    }
    on.exit(Sys.setlocale("LC_CTYPE", Sys.getlocale("LC_CTYPE")),
        add = TRUE)
    Sys.setlocale("LC_CTYPE", "C")
    lines <- readLines(file)
    ind <- grep("^[^[:blank:]][^:]*$", lines)
    if (length(ind)) {
        lines <- strtrim(lines[ind], 0.7 * getOption("width"))
        stop(gettextf("Invalid DCF format.\nRegular lines must have a tag.\nOffending lines start with:\n%s",
            paste0("  ", lines, collapse = "\n")), domain = NA)
    }
    line_is_not_empty <- !grepl("^[[:space:]]*$", lines)
    nums <- cumsum(diff(c(FALSE, line_is_not_empty) > 0L) > 0L)
    nums <- nums[line_is_not_empty]
    lines <- lines[line_is_not_empty]
    line_is_escaped_blank <- grepl("^[[:space:]]+\\.[[:space:]]*$",
        lines)
    if (any(line_is_escaped_blank))
        lines[line_is_escaped_blank] <- ""
    line_has_tag <- grepl("^[^[:blank:]][^:]*:", lines)
    ind <- which(!line_has_tag[which(diff(nums) > 0L) + 1L])
    if (length(ind)) {
        lines <- strtrim(lines[ind], 0.7 * getOption("width"))
        stop(gettextf("Invalid DCF format.\nContinuation lines must not start a record.\nOffending lines start with:\n%s",
            paste0("  ", lines, collapse = "\n")), domain = NA)
    }
    lengths <- rle(cumsum(line_has_tag))$lengths
    pos <- cumsum(lengths)
    tags <- sub(":.*", "", lines[line_has_tag])
    lines[line_has_tag] <- sub("[^:]*:[[:space:]]*", "", lines[line_has_tag])
    foldable <- rep.int(is.na(match(tags, keep.white)), lengths)
    lines[foldable] <- sub("^[[:space:]]*", "", lines[foldable])
    lines[foldable] <- sub("[[:space:]]*$", "", lines[foldable])
    vals <- mapply(function(from, to) paste(lines[from:to], collapse = "\n"),
        c(1L, pos[-length(pos)] + 1L), pos)
    out <- .assemble_things_into_a_data_frame(tags, vals, nums[pos])
    if (!is.null(fields))
        out <- out[fields]
    out
}
Browse[2]> str(file)
 chr "climatol_2.2.tar.gz/DESCRIPTION"
Browse[2]> head(file)
[1] "climatol_2.2.tar.gz/DESCRIPTION"
Browse[2]>
debug: if (is.character(file)) {
    file <- gzfile(file)
    on.exit(close(file))
}
Browse[2]>
debug: file <- gzfile(file)
Browse[2]>
debug: on.exit(close(file))
Browse[2]>
debug: if (!inherits(file, "connection")) stop("'file' must be a character string or connection")
Browse[2]>
debug: if (!all) return(.Internal(readDCF(file, fields, keep.white)))
Browse[2]> str(file)
Classes 'gzfile', 'connection'  atomic [1:1] 3
  ..- attr(*, "conn_id")=<externalptr>
Browse[2]> file
                      description                             class
"climatol_2.2.tar.gz/DESCRIPTION"                          "gzfile"
                             mode                              text
                             "rb"                            "text"
                           opened                          can read
                         "closed"                             "yes"
                        can write
                            "yes"
Browse[2]>
debug: return(.Internal(readDCF(file, fields, keep.white)))
Browse[2]>
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
  cannot open the connection
In addition: Warning message:
In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
  cannot open compressed file 'climatol_2.2.tar.gz/DESCRIPTION', probable reason 'No such file or directory'
>

Well coming to debug: if (!all) return(.Internal(readDCF(file, fields, keep.white))) I loose control and R returns to prompt with an error.

Hopefully one of you can replicate this. If not then it must have something with Windows OS to do. But what?



Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
frtog at vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender.

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Jeff Newmiller
> Sent: 20. april 2014 23:33
> To: Alpesh Pandya; Rui Barradas
> Cc: r-help at r-project.org; Uwe Ligges
> Subject: Re: [R] R 3.0.3, Windows 7: Problem installing XML package
>
> Hard to help you when the problem simply does not happen for others.
>
> As for Windows being not a focus, that is not at all true. I use it regularly on
> Windows at work. That being said, there are thousands of packages and
> those each involve their own subset of R users. There are also many
> operating system configurations that may not all be fully tested. Blaming "R"
> or "Windows", or blaming us for "preventing" you from getting your
> education (isn't that something between you and your educational
> institution?) are not going to be effective strategies for problem solving.
>
> Are you able to use other aspects of R beyond the XML package? Have you
> tried communicating with the maintainers of that package?
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> On April 20, 2014 11:45:44 AM PDT, Alpesh Pandya
> <alpeshpandya at gmail.com> wrote:
> >I keep on trying from various networks but I still get the same error.
> >I
> >don't this this has anything to do with network or ability to download
> >the
> >package (as I can install other packages fine). This must be something
> >in
> >base R or dependencies issues (that R is not spelling out).
> >
> >I know R is geared for Mac and Windows is kind of looked down upon but
> >I
> >have no option but use windows and need this XML package running to
> >complete my education. Any help on this would be appreciated.
> >
> >
> >On Mon, Apr 14, 2014 at 2:24 PM, Alpesh Pandya
> ><alpeshpandya at gmail.com>wrote:
> >
> >> Thank you for response Rui.
> >>
> >> I still get the same error with this repository.
> >>
> >> Installing package into
> >���C:/Users/APandya/Documents/R/win-library/3.0���
> >> (as ���lib��� is unspecified)
> >> trying URL '
> >> http://cran.dcc.fc.up.pt/bin/windows/contrib/3.0/XML_3.98-1.1.zip'
> >> Content type 'application/zip' length 4288136 bytes (4.1 Mb)
> >> opened URL
> >> downloaded 4.1 Mb
> >>
> >> Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package",
> >"Type"))
> >> :
> >>   cannot open the connection
> >> In addition: Warning messages:
> >> 1: In download.file(url, destfile, method, mode = "wb", ...) :
> >>   downloaded length 4276224 != reported length 4288136
> >> 2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip
> >file
> >> 3: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package",
> >"Type")) :
> >>   cannot open compressed file 'XML/DESCRIPTION', probable reason 'No
> >such
> >> file or directory'
> >>
> >>
> >>
> >> On Mon, Apr 14, 2014 at 2:17 PM, Rui Barradas
> ><ruipbarradas at sapo.pt>wrote:
> >>
> >>> Hello,
> >>> I have package XML installed on Windows 7, R 3.0.3 and I had no
> >problem
> >>> at all. Can't you try (it worked with me)
> >>>
> >>> install.packages("XML", repos = "http://cran.dcc.fc.up.pt")
> >>>
> >>> Hope this helps,
> >>>
> >>> Rui Barradas
> >>>
> >>> Em 14-04-2014 16:24, Alpesh Pandya escreveu:
> >>>
> >>>  I have tried these sources (almost all US mirrors):
> >>>>
> >>>>
> >http://cran.cnr.Berkeley.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
> >>>> http://cran.stat.ucla.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
> >>>> http://streaming.stat.iastate.edu/CRAN/bin/windows/contrib/
> >>>> 3.0/XML_3.98-1.1.zip
> >>>>
> >http://ftp.ussg.iu.edu/CRAN/bin/windows/contrib/3.0/XML_3.98-1.1.zip
> >>>>
> >http://rweb.quant.ku.edu/cran/bin/windows/contrib/3.0/XML_3.98-1.1.zip
> >>>> http://watson.nci.nih.gov/cran_mirror/bin/windows/
> >>>> contrib/3.0/XML_3.98-1.1.zip
> >>>> http://cran.mtu.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
> >>>> http://cran.wustl.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
> >>>> http://cran.case.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
> >>>>
> >http://ftp.osuosl.org/pub/cran/bin/windows/contrib/3.0/XML_3.98-1.1.zip
> >>>>
> >http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/3.0/XML_3.98-
> 1.1.zip
> >>>>
> >>>> I have confirmed with IT that there is no restriction on
> >downloading this
> >>>> zip file from any of these sources. Also I am getting same error
> >when I
> >>>> try
> >>>> from my home network as well.
> >>>>
> >>>>
> >>>> On Sun, Apr 13, 2014 at 9:46 AM, Uwe Ligges <
> >>>> ligges at statistik.tu-dortmund.de
> >>>>
> >>>>> wrote:
> >>>>>
> >>>>
> >>>>
> >>>>>
> >>>>> On 13.04.2014 01:30, Alpesh Pandya wrote:
> >>>>>
> >>>>>  @Uwe I tried the same steps from office as well as home network
> >with
> >>>>>> same
> >>>>>> results. Are you using windows 7 with R 3.0.3?
> >>>>>>
> >>>>>> I have seen same question being asked by others without any
> >>>>>> resolution. Is
> >>>>>> anything special about XML package? I am OK use older version of
> >>>>>> package
> >>>>>> but in archives there are no zip files (only gz files). Is
> >windows
> >>>>>> platform
> >>>>>> not recommended for R?
> >>>>>>
> >>>>>>
> >>>>> Right, and you can try to install these from sources.
> >>>>> But I doubt you need it. You still have not told us if you tried
> >another
> >>>>> mirror to download the XML file from and what you local IT support
> >tells
> >>>>> you while your downloads are incomplete.
> >>>>>
> >>>>> Best,
> >>>>> Uwe Ligges
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> On Sat, Apr 12, 2014 at 7:22 PM, Uwe Ligges <
> >>>>>> ligges at statistik.tu-dortmund.de
> >>>>>>
> >>>>>>  wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> On 12.04.2014 22:39, Alpesh Pandya wrote:
> >>>>>>>
> >>>>>>>   Thank you for response Uwe. I tried multiple times by
> >downloading
> >>>>>>> the
> >>>>>>>
> >>>>>>>> zip
> >>>>>>>> file from many sources but still the same error. This is a
> >major road
> >>>>>>>> block
> >>>>>>>> for me in using R. Appreciate any help on this.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>  Please ask your local IT staff.
> >>>>>>>
> >>>>>>> I get, using the same mirror:
> >>>>>>>
> >>>>>>>
> >options("repos"=c(CRAN="http://watson.nci.nih.gov/cran_mirror"))
> >>>>>>>
> >>>>>>>> install.packages("XML", lib="d:/temp")
> >>>>>>>>
> >>>>>>>>
> >>>>>>> trying URL 'http://watson.nci.nih.gov/cran_mirror/bin/windows/
> >>>>>>>
> >>>>>>> contrib/3.0/XML_3.98-1.1.zip'
> >>>>>>> Content type 'application/zip' length 4288136 bytes (4.1 Mb)
> >>>>>>> opened URL
> >>>>>>> downloaded 4.1 Mb
> >>>>>>>
> >>>>>>> package 'XML' successfully unpacked and MD5 sums checked
> >>>>>>>
> >>>>>>> The downloaded binary packages are in
> >>>>>>>           d:\temp\RtmpqMqL8L\downloaded_packages
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Best,
> >>>>>>> Uwe Ligges
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>  On Fri, Apr 11, 2014 at 6:53 PM, Uwe Ligges <
> >>>>>>>> ligges at statistik.tu-dortmund.de
> >>>>>>>>
> >>>>>>>>   wrote:
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>     Works for me.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> Best,
> >>>>>>>>> Uwe Ligges
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> On 11.04.2014 17:10, Alpesh Pandya wrote:
> >>>>>>>>>
> >>>>>>>>>    Using install.package('XML') command produces this error:
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>> trying URL
> >>>>>>>>>> '
> >>>>>>>>>> http://watson.nci.nih.gov/cran_mirror/bin/windows/
> >>>>>>>>>> contrib/3.0/XML_3.98-1.1.zip
> >>>>>>>>>> '
> >>>>>>>>>> Content type 'application/zip' length 4288136 bytes (4.1 Mb)
> >>>>>>>>>> opened URL
> >>>>>>>>>> downloaded 4.1 Mb
> >>>>>>>>>>
> >>>>>>>>>> Error in read.dcf(file.path(pkgname, "DESCRIPTION"),
> >c("Package",
> >>>>>>>>>> "Type")) :
> >>>>>>>>>>       cannot open the connection
> >>>>>>>>>> In addition: Warning messages:
> >>>>>>>>>> 1: In download.file(url, destfile, method, mode = "wb", ...)
> >:
> >>>>>>>>>>       downloaded length 4276224 != reported length 4288136
> >>>>>>>>>> 2: In unzip(zipname, exdir = dest) : error 1 in extracting
> >from zip
> >>>>>>>>>> file
> >>>>>>>>>> 3: In read.dcf(file.path(pkgname, "DESCRIPTION"),
> >c("Package",
> >>>>>>>>>> "Type"))
> >>>>>>>>>> :
> >>>>>>>>>>       cannot open compressed file 'XML/DESCRIPTION', probable
> >>>>>>>>>> reason
> >>>>>>>>>> 'No
> >>>>>>>>>> such
> >>>>>>>>>> file or directory'
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Upon receiving this error, I downloaded XML_3.98-1.1.zip
> >directly
> >>>>>>>>>> from
> >>>>>>>>>> cran
> >>>>>>>>>> site. But this zip file is not a valid archive (cannot open
> >using
> >>>>>>>>>> winzip).
> >>>>>>>>>> Also trying to install using this downloaded file produces
> >the
> >>>>>>>>>> following
> >>>>>>>>>> error:
> >>>>>>>>>>
> >>>>>>>>>> Installing package into 'C:/Users/APandya/Documents/R/
> >>>>>>>>>> win-library/3.0'
> >>>>>>>>>> (as 'lib' is unspecified)
> >>>>>>>>>> Warning in install.packages :
> >>>>>>>>>>       error 1 in extracting from zip file
> >>>>>>>>>> Warning in install.packages :
> >>>>>>>>>>       cannot open compressed file 'XML/DESCRIPTION', probable
> >>>>>>>>>> reason
> >>>>>>>>>> 'No
> >>>>>>>>>> such
> >>>>>>>>>> file or directory'
> >>>>>>>>>> Error in install.packages : cannot open the connection
> >>>>>>>>>>
> >>>>>>>>>> I  downloaded this zip file from multiple sources and tried
> >to
> >>>>>>>>>> install
> >>>>>>>>>> with
> >>>>>>>>>> same result.
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>
> >>
> >> --
> >> Thanks and Regards
> >> Alpesh
> >>
>
> ______________________________________________
> 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