packrat:::init() fails in existing project

1,027 views
Skip to first unread message

Jeff Evans

unread,
Aug 19, 2014, 3:22:30 PM8/19/14
to packrat...@googlegroups.com
Hi all,

I am an experienced R user but new to packrat. I have an existing project that I'd like to try managing with packrat, but I'm getting an error.

I open the project using RStudio and type packrat:::init() since I'm already in the proper directory.

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

> packrat::init()
Error in hash(system.file("DESCRIPTION", package = x)) : 
  No DESCRIPTION file at path ''!
In addition: Warning message:
In inferPackageRecord(df) : Couldn't figure out the origin of package caret

I need to use the older version of R because the code and analysis I am trying to package were run in that version.

Any idea what this error refers to and how to move forward?

Thanks,
Jeff

Kevin Ushey

unread,
Aug 19, 2014, 5:57:23 PM8/19/14
to packrat...@googlegroups.com
Hi Jeff,

Thanks for the report -- this looks like a bug in packrat; I'll take a look.

You should be able to side-step the problem by first manually installing caret (into the user library), and then calling packrat::init -- but I will also investigate so that you don't run into this kind of bug in the future.

Thanks,
Kevin

Kevin Ushey

unread,
Aug 19, 2014, 6:05:13 PM8/19/14
to packrat...@googlegroups.com
Actually, this is a bit odd -- packrat reports that it cannot find the origin of the package `caret`, and presumedly the system.file call is failing because it cannot find `caret` in any of the current `.libPaths()` either.

Can you provide some more details:

1. Do you have `caret` installed, and can it be loaded with a regular `library(caret)` call?
2. What is the output of `.libPaths()`?
3. What is the output of `system.file(package = "caret")`?
4. If the above is not `""`, what is the output of `readLines(system.file("DESCRIPTION", package = "caret"))`?

Thanks,
Kevin

Jeff Evans

unread,
Aug 29, 2014, 4:22:45 PM8/29/14
to packrat...@googlegroups.com
Hi Kevin,

My responses to your questions are below. I do keep most of my packages in an R directory inside My Documents, as you'll see from the .libPaths output. I set this in the Rprofile.site file.

Thanks,
Jeff


1. Do you have `caret` installed, and can it be loaded with a regular `library(caret)` call?

Yes, I can load it with 'library(caret)'


2. What is the output of `.libPaths()`?

> .libPaths()
[1] "C:/Users/Jeffrey/Documents/R/win-library/3.0.2"
[2] "C:/Program Files/R/R-3.0.2/library"            
 
3. What is the output of `system.file(package = "caret")`?
> system.file(package = "caret")
[1] "C:/Users/Jeffrey/Documents/R/win-library/3.0.2/caret"
4. If the above is not `""`, what is the output of `readLines(system.file("DESCRIPTION", package = "caret"))`?
> readLines(system.file("DESCRIPTION", package = "caret"))
 [1] "Package: caret"                                                                            
 [2] "Version: 6.0-22"                                                                           
 [3] "Date: 2014 -01-07"                                                                         
 [4] "Title: Classification and Regression Training"                                             
 [5] "Author: Max Kuhn. Contributions from Jed Wing, Steve Weston, Andre"                        
 [6] "  Williams, Chris Keefer, Allan Engelhardt, Tony Cooper, Zachary Mayer"                    
 [7] "  and the R Core Team"                                                                     
 [8] "Description: Misc functions for training and plotting classification and regression models"
 [9] "Maintainer: Max Kuhn <**************>" # I'm redacting Max's email address here, though it is quite public. -Jeff                                             
[10] "Depends: R (>= 2.10), stats, lattice (>= 0.20), ggplot2"                                   
[11] "URL: http://caret.r-forge.r-project.org/"                                                  
[12] "Imports: car, reshape2, foreach, methods, plyr"                                            
[13] "Suggests: e1071, earth (>= 2.2-3), ellipse, fastICA, gam, ipred,"                          
[14] "        kernlab, klaR, MASS, mda, mgcv, mlbench, nnet, party (>="                          
[15] "        0.9-99992), pls, pROC, proxy, randomForest, RANN, spls, affy"                      
[16] "License: GPL-2"                                                                            
[17] "Packaged: 2014-01-07 23:23:55 UTC; kuhna03"                                                
[18] "Built: R 3.0.2; x86_64-w64-mingw32; 2014-01-08 16:04:15 UTC; windows"                      
[19] "Archs: x64"                                                                             

Jeff Evans

unread,
Sep 5, 2014, 3:15:28 PM9/5/14
to packrat...@googlegroups.com
Hi Kevin,

I updated to packrat 0.4.1-1 today and tried again.

It seems you've resolved my earlier problem with caret. Harrah!

Now I'm having trouble with rdgal. Any idea what the holdup might be? Here's the output with the error.

Thanks again,
Jeff

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 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.

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(packrat)
Warning message:
package ‘packrat’ was built under R version 3.0.3 
> packrat:::init()
Initializing packrat project in directory:
- "D:/Jeffs Work/Illinois/Evans_et_al_Code_Supplement"

Adding these packages to packrat:
                  _          
    AICcmodavg      1.35     
    BradleyTerry2   1.0-5    
    brglm           0.5-9    
    car             2.0-19   
    caret           6.0-35   
    colorspace      1.2-4    
    data.table      1.8.10   
    dichromat       2.0-0    
    digest          0.6.4    
    doSNOW          1.0.9    
    fields          6.9.1    
    foreach         1.4.1    
    ggplot2         0.9.3.1  
    gridExtra       0.9.1    
    gtable          0.1.2    
    gtools          3.1.1    
    iterators       1.0.6    
    labeling        0.2      
    lme4            1.0-5    
    mapproj         1.2-1    
    maps            2.3-6    
    maptools        0.8-29   
    Matrix          1.1-1.1  
    minqa           1.2.2    
    munsell         0.4.2    
    nloptr          1.0.4    
    packrat         0.4.1-1  
    plyr            1.8      
    ppcor           1.0      
    profileModel    0.5-9    
    proto           0.3-10   
    psych           1.3.12   
    pwr             1.1.1    
    RColorBrewer    1.0-5    
    Rcpp            0.10.6   
    RcppEigen       0.3.2.0.1
    reshape2        1.2.2    
    rgdal           0.8-14   
    rgeos           0.3-5    
    rJava           0.9-6    
    rpart.plot      1.4-3    
    scales          0.2.3    
    snow            0.3-13   
    sp              1.0-14   
    spam            0.40-0   
    stringr         0.6.2    
    xlsx            0.5.5    
    xlsxjars        0.5.0    

Fetching sources for AICcmodavg (1.35) ... OK (CRAN archived)
Fetching sources for BradleyTerry2 (1.0-5) ... OK (CRAN current)
Fetching sources for brglm (0.5-9) ... OK (CRAN current)
Fetching sources for car (2.0-19) ... OK (CRAN archived)
Fetching sources for caret (6.0-35) ... OK (CRAN current)
Fetching sources for colorspace (1.2-4) ... OK (CRAN current)
Fetching sources for data.table (1.8.10) ... OK (CRAN archived)
Fetching sources for dichromat (2.0-0) ... OK (CRAN current)
Fetching sources for digest (0.6.4) ... OK (CRAN current)
Fetching sources for doSNOW (1.0.9) ... OK (CRAN archived)
Fetching sources for fields (6.9.1) ... OK (CRAN archived)
Fetching sources for foreach (1.4.1) ... OK (CRAN archived)
Fetching sources for ggplot2 (0.9.3.1) ... OK (CRAN archived)
Fetching sources for gridExtra (0.9.1) ... OK (CRAN current)
Fetching sources for gtable (0.1.2) ... OK (CRAN current)
Fetching sources for gtools (3.1.1) ... OK (CRAN archived)
Fetching sources for iterators (1.0.6) ... OK (CRAN archived)
Fetching sources for labeling (0.2) ... OK (CRAN archived)
Fetching sources for lme4 (1.0-5) ... OK (CRAN archived)
Fetching sources for mapproj (1.2-1) ... OK (CRAN archived)
Fetching sources for maps (2.3-6) ... OK (CRAN archived)
Fetching sources for maptools (0.8-29) ... OK (CRAN archived)
Fetching sources for Matrix (1.1-1.1) ... OK (CRAN archived)
Fetching sources for minqa (1.2.2) ... OK (CRAN archived)
Fetching sources for munsell (0.4.2) ... OK (CRAN current)
Fetching sources for nloptr (1.0.4) ... OK (CRAN current)
Fetching sources for packrat (0.4.1-1) ... OK (CRAN current)
Fetching sources for plyr (1.8) ... OK (CRAN archived)
Fetching sources for ppcor (1.0) ... OK (CRAN current)
Fetching sources for profileModel (0.5-9) ... OK (CRAN current)
Fetching sources for proto (0.3-10) ... OK (CRAN current)
Fetching sources for psych (1.3.12) ... OK (CRAN archived)
Fetching sources for pwr (1.1.1) ... OK (CRAN current)
Fetching sources for RColorBrewer (1.0-5) ... OK (CRAN current)
Fetching sources for Rcpp (0.10.6) ... OK (CRAN archived)
Fetching sources for RcppEigen (0.3.2.0.1) ... OK (CRAN archived)
Fetching sources for reshape2 (1.2.2) ... OK (CRAN archived)
Fetching sources for rgdal (0.8-14) ... OK (CRAN archived)
Fetching sources for rgeos (0.3-5) ... OK (CRAN archived)
Fetching sources for rJava (0.9-6) ... OK (CRAN current)
Fetching sources for rpart.plot (1.4-3) ... OK (CRAN archived)
Fetching sources for scales (0.2.3) ... OK (CRAN archived)
Fetching sources for snow (0.3-13) ... OK (CRAN current)
Fetching sources for sp (1.0-14) ... OK (CRAN archived)
Fetching sources for spam (0.40-0) ... OK (CRAN archived)
Fetching sources for stringr (0.6.2) ... OK (CRAN current)
Fetching sources for xlsx (0.5.5) ... OK (CRAN archived)
Fetching sources for xlsxjars (0.5.0) ... OK (CRAN archived)
Snapshot written to "D:/Jeffs Work/Illinois/Evans_et_al_Code_Supplement/packrat/packrat.lock"
Installing AICcmodavg (1.35) ... OK (built source)
Installing car (2.0-19) ... OK (built source)
Installing colorspace (1.2-4) ... OK (downloaded binary)
Installing data.table (1.8.10) ... OK (built source)
Installing dichromat (2.0-0) ... OK (downloaded binary)
Installing digest (0.6.4) ... OK (downloaded binary)
Installing gridExtra (0.9.1) ... OK (downloaded binary)
Installing gtable (0.1.2) ... OK (downloaded binary)
Installing gtools (3.1.1) ... OK (built source)
Installing iterators (1.0.6) ... OK (built source)
Installing labeling (0.2) ... OK (built source)
Installing maps (2.3-6) ... OK (built source)
Installing Matrix (1.1-1.1) ... OK (built source)
Installing nloptr (1.0.4) ... OK (downloaded binary)
Installing packrat (0.4.1-1) ... OK (downloaded binary)
Installing plyr (1.8) ... OK (built source)
Installing ppcor (1.0) ... OK (downloaded binary)
Installing profileModel (0.5-9) ... OK (downloaded binary)
Installing proto (0.3-10) ... OK (downloaded binary)
Installing psych (1.3.12) ... OK (built source)
Installing pwr (1.1.1) ... OK (downloaded binary)
Installing RColorBrewer (1.0-5) ... OK (downloaded binary)
Installing Rcpp (0.10.6) ... OK (built source)
Installing rJava (0.9-6) ... OK (downloaded binary)
Installing rpart.plot (1.4-3) ... OK (built source)
Installing snow (0.3-13) ... OK (downloaded binary)
Installing sp (1.0-14) ... OK (built source)
Installing spam (0.40-0) ... OK (built source)
Installing stringr (0.6.2) ... OK (downloaded binary)
Installing munsell (0.4.2) ... OK (downloaded binary)
Installing foreach (1.4.1) ... OK (built source)
Installing mapproj (1.2-1) ... OK (built source)
Installing brglm (0.5-9) ... OK (downloaded binary)
Installing minqa (1.2.2) ... OK (built source)
Installing RcppEigen (0.3.2.0.1) ... OK (built source)
Installing xlsxjars (0.5.0) ... OK (built source)
Installing maptools (0.8-29) ... OK (built source)
Installing rgdal (0.8-14) ... Error: Command failed (1)

The command failed with output:
* installing *source* package 'rgdal' ...
** package 'rgdal' successfully unpacked and MD5 sums checked
cp: cannot stat `/share/proj': No such file or directory
cp: cannot stat `/share/gdal': No such file or directory
ERROR: configuration failed for package 'rgdal'
* removing 'D:/Jeffs Work/Illinois/Evans_et_al_Code_Supplement/packrat/lib/x86_64-w64-mingw32/3.0.2/rgdal'
In addition: Warning message:
package ‘packrat’ was built under R version 3.0.3 

>


Kevin Ushey

unread,
Sep 5, 2014, 3:34:29 PM9/5/14
to Jeff Evans, packrat...@googlegroups.com

Hi Jeff,

It looks like rgdal has some pretty complex dependencies, and so building it from source is tricky. Packrat detects that you have an out-of-date version of rgdal in your user library, and tries to install the same version of the package (but from source).

You might work around this by updating rgdal in your main library, e.g. in a non-packrat project do:

install.packages("rgdal")

This should download a binary of rgdal from CRAN to use in your (user) library, and then later packrat will see that you have an up-to-date version of rgdal installed and use the same binary from CRAN.

Alternatively, you need to figure out how to get the other rgdal dependencies — but that seems very tricky…

I think this also implies that packrat needs to provide some kind of better handling for ‘hard to compile’ packages, but I am not sure what the best behavior is here.

Thanks,
Kevin



--
You received this message because you are subscribed to the Google Groups "packrat-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packrat-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages