[R] Error installing packages

Marc Schwartz marc_schwartz at me.com
Wed Oct 19 14:32:56 CEST 2016


> On Oct 19, 2016, at 6: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’
> Error: package ‘ggplot2’ could not be loaded
> > install.packages("ggplot2",dependencies=TRUE)
> 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'
> > 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,

My first reaction is that some of the downloaded packages were corrupted, therefore not properly installed. There may be a problem with the mirror and/or the internet connection was compromised. There are messages above indicating file length differences between what was downloaded versus what the server indicated as the file size.

You might try a different CRAN mirror to see if that resolves the issue, albeit, I just tried to directly download a couple of the zip files on my Mac from the same mirror and did not have any issues, so it may be a transient server problem.

It is also possible that if the local package installation on their computer is corrupted in some manner, you may need to delete all CRAN based packages they installed fully and re-install all of the packages that are required, so that you have a level of comfort in the integrity of the local package installation.

Regards,

Marc Schwartz



More information about the R-help mailing list