Skip to content

packrat::restore deletes sources then complains it can't find them #560

@torbjorn

Description

@torbjorn

I'm experiencing odd behavior.

I using packrat to control the production R environment, but deploying to production and calling restore does strange things. At first go it removes sources of the package I want to restore. It then complains it can't find the sources.

I do the following:

  1. packrat::install_local("ga.data") # on development system
  2. rsync the packrat dir using --delete, over to the production environment's packrat dir
  3. start R in production environment's packrat dir
  4. packrat::restore() # on production system
  5. go back to repeat the rsync
  6. restore again, this time it works.

Odd. In my setup this is reproducing every time.

Here is the text output from a terminal as I go through the steps:

    ## After rsync of development system to the production system, sources
    ##   of a particular package, ga.data, looks like this:

    tl@gamap(/var/www/profileplotter/perl/R_Home)$ ll packrat/src/ga.data/
    total 6492
    -rw-rw-r--+ 1 tl tl 1070060 May  9 10:14 ga.data_1.3.7-10.tar.gz
    -rw-r--r--+ 1 tl tl 1070072 May  9 10:14 ga.data_1.3.7-24.tar.gz
    -rw-r--r--+ 1 tl tl 1070288 May  9 10:14 ga.data_1.3.7-30.tar.gz
    -rw-r--r--+ 1 tl tl 1131170 May  9 10:14 ga.data_1.3.8-3.tar.gz
    -rw-r--r--+ 1 tl tl 1131817 May  9 10:14 ga.data_1.3.9-3.tar.gz
    -rw-r--r--+ 1 tl tl 1131821 May 24 13:39 ga.data_1.3.9-5.tar.gz

    ## entering R to restore - it complains it can't find 1.3.9_5

    tl@gamap(/var/www/profileplotter/perl/R_Home)$ R -q
    Packrat mode on. Using library in directory:
    - "/var/www/profileplotter/perl/R_Home/packrat/lib"
    > packrat::restore()
    Replacing ga.data (upgrade 1.3.9-3 to 1.3.9-5) ... Error in installPkg(pkgRecord, project, repos, lib) : 
      Failed to install ga.data (1.3.9-5): sources missing at /var/www/profileplotter/perl/R_Home/packrat/src/ga.data/ga.data_1.3.9-5.tar.gz
    In addition: Warning message:
    In packrat::restore() :
      The most recent snapshot was generated using R version 3.5.3
    > packrat::restore()
    Installing ga.data (1.3.9-5) ... 
    Error in installPkg(pkgRecord, project, repos, lib) : 
      Failed to install ga.data (1.3.9-5): sources missing at /var/www/profileplotter/perl/R_Home/packrat/src/ga.data/ga.data_1.3.9-5.tar.gz
    In addition: Warning message:
    In packrat::restore() :
      The most recent snapshot was generated using R version 3.5.3
    > 
    Save workspace image? [y/n/c]:

    ## And indeed, now that particular source (and a bunch of other sources is gone)

    tl@gamap(/var/www/profileplotter/perl/R_Home)$ ll packrat/src/ga.data/
    total 1108
    -rw-rw-r--+ 1 tl tl 1129979 May 24 13:42 ga.data_1.3.9-1.tar.gz


    ## I repeat rsync the packrat dir from development system, now the sources are back again:

    tl@gamap(/var/www/profileplotter/perl/R_Home)$ ll packrat/src/ga.data/
    total 6492
    -rw-rw-r--+ 1 tl tl 1070060 May 24 13:42 ga.data_1.3.7-10.tar.gz
    -rw-r--r--+ 1 tl tl 1070072 May 24 13:42 ga.data_1.3.7-24.tar.gz
    -rw-r--r--+ 1 tl tl 1070288 May 24 13:42 ga.data_1.3.7-30.tar.gz
    -rw-r--r--+ 1 tl tl 1131170 May 24 13:42 ga.data_1.3.8-3.tar.gz
    -rw-r--r--+ 1 tl tl 1131817 May 24 13:42 ga.data_1.3.9-3.tar.gz
    -rw-r--r--+ 1 tl tl 1131821 May 24 13:42 ga.data_1.3.9-5.tar.gz

    ## And this time restore works:

    tl@gamap(/var/www/profileplotter/perl/R_Home)$ R -q
    Packrat mode on. Using library in directory:
    - "/var/www/profileplotter/perl/R_Home/packrat/lib"
    p> packrat::restore()
    Installing ga.data (1.3.9-5) ... 
            OK (built source)
    Warning message:
    In packrat::restore() :
      The most recent snapshot was generated using R version 3.5.3
    > 
    Save workspace image? [y/n/c]:

    tl@gamap(/var/www/profileplotter/perl/R_Home)$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions