[R] Error installing packages

David Winsemius dwinsemius at comcast.net
Wed Oct 19 17:31:48 CEST 2016


> On Oct 19, 2016, at 4:54 AM, Kevin E. Thorpe <kevin.thorpe at utoronto.ca> wrote:
> 
> Hello.
> 
> I am posting this on behalf of one of my students who is getting error messages when installing some packages. I have not seen this before nor have I been able to replicate it. I'm including the relevant (I think) information. I get the students to install rms with dependencies. As you can see, rms does get installed but when the attempt is made to attach it, ggplot2 cannot be loaded. Thus I tried explicitly installing ggplot2 and you can see then ensuing errors below. I have included the sessionInfo() at the end.
> 
> I hope someone can point me at a solution.
> 
> 
> R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
> Copyright (C) 2016 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.
> 
> > install.packages("rms",dependencies=TRUE)
> Installing package into ‘C:/Users/Leticia/Documents/R/win-library/3.3’
> (as ‘lib’ is unspecified)
> --- Please select a CRAN mirror for use in this session ---
> trying URL 'http://cran.utstat.utoronto.ca/bin/windows/contrib/3.3/rms_4.5-0.zip'
> Content type 'application/zip' length 1074995 bytes (1.0 MB)
> downloaded 1.0 MB
> 
> package ‘rms’ successfully unpacked and MD5 sums checked
> 
> The downloaded binary packages are in
>        C:\Users\Leticia\AppData\Local\Temp\Rtmpa0q2o2\downloaded_packages
> > library(rms)
> Loading required package: Hmisc
> Loading required package: lattice
> Loading required package: survival
> Loading required package: Formula
> Loading required package: ggplot2
> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
>  there is no package called ‘Rcpp’

When I try to debug the installation errors, I always first try to fix the first error. In this case it is because Rcpp was not installed. The use of dependencies=TRUE does not cause a recursive installation of dependencies of dependencies. I would have simply used:

install.packages('Rcpp", dependencies=TRUE)


> Error: package ‘ggplot2’ could not be loaded
> > install.packages("ggplot2",dependencies=TRUE)

That was not the problem.

> Installing package into ‘C:/Users/Leticia/Documents/R/win-library/3.3’
> (as ‘lib’ is unspecified)
> also installing the dependency ‘maptools’
> 
> trying URL 'http://cran.utstat.utoronto.ca/bin/windows/contrib/3.3/maptools_0.8-39.zip'
> Content type 'application/zip' length 1816384 bytes (1.7 MB)
> downloaded 0 bytes
> 
> trying URL 'http://cran.utstat.utoronto.ca/bin/windows/contrib/3.3/ggplot2_2.1.0.zip'
> Content type 'application/zip' length 1996146 bytes (1.9 MB)
> downloaded 4096 bytes
> 
> 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 0 != reported length 1816384
> 2: In download.file(url, destfile, method, mode = "wb", ...) :
>  downloaded length 4096 != reported length 1996146
> 3: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
> 4: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
>  cannot open compressed file 'maptools/DESCRIPTION', probable reason 'No such file or directory'

The second error suggests a temporary difficulty in the download process. I'm guessing the user will not encounter it on a second attempt.


Best;
David.

> > library(rms)
> Loading required package: Hmisc
> Loading required package: ggplot2
> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
>  there is no package called ‘Rcpp’
> Error: package ‘ggplot2’ could not be loaded
> > session.info()
> Error: could not find function "session.info"
> > sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 10 x64 (build 10586)
> 
> locale:
> [1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252
> [4] LC_NUMERIC=C                    LC_TIME=English_Canada.1252
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> other attached packages:
> [1] Formula_1.2-1   survival_2.39-4 lattice_0.20-33
> 
> loaded via a namespace (and not attached):
> [1] Matrix_1.2-6  tools_3.3.1   gtable_0.2.0  splines_3.3.1 grid_3.3.1
> >
> 
> -- 
> Kevin E. Thorpe
> Head of Biostatistics,  Applied Health Research Centre (AHRC)
> Li Ka Shing Knowledge Institute of St. Michael's Hospital
> Assistant Professor, Dalla Lana School of Public Health
> University of Toronto
> email: kevin.thorpe at utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list