Skip to content

R 3.0.3, Windows 7: Problem installing XML package

15 messages · Uwe Ligges, Alpesh Pandya, Rui Barradas +4 more

#
Works for me.

Best,
Uwe Ligges
On 11.04.2014 17:10, Alpesh Pandya wrote:
#
On 12.04.2014 22:39, Alpesh Pandya wrote:
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 13.04.2014 01:30, Alpesh Pandya wrote:
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
1 day later
#
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:
6 days later
#
On 20/04/2014, 2:45 PM, Alpesh Pandya wrote:
This is very clearly a problem with your setup, not with R:  nobody else 
is reporting it.

What you should do is download the .zip file using some other means 
(e.g. Firefox, etc.) and check whether the size comes out properly 
(4,288,694 bytes; not sure why you saw the numbers you saw).  If it 
does, then install the package from the .zip file.  If it doesn't, then 
tell your IT people to fix your system.

Duncan Murdoch
#
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:
#
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
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.
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.
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.
#
Frede... Windows uses zip files (binary, aka pre-compiled format) for packages by default, because most installations don't have the development tools installed. You need to setup RTools and use the "source" option to install_package in order to handle the tar.gz package file, or download and install the zip file instead.
---------------------------------------------------------------------------
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:01:17 PM PDT, "Frede Aakmann T?gersen" <frtog at vestas.com> wrote:
#
At 08:43 21/04/2014, Jeff Newmiller wrote:
Jeff, Frede did say that there is no C or Fortran 
in the package which suggests that it should be 
possible to install it under Windows without 
installing RTools first if I understand correctly.
Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html