Restoring from packrat/scr instead of CRAN?

230 views
Skip to first unread message

Rebecca Vessenes

unread,
Oct 31, 2016, 3:26:04 PM10/31/16
to packrat-discuss
Hi-

How can I force packrat to unbundle/restore from the packrat/scr files (or a localCRAN-like  repo)  and not try to connect to CRAN? 

 I've used packrat for my project on a development machine, installing packages from CRAN.  I now need to move to to a machine that will not have CRAN access.  When I try to unbundle/restore packrat on the new machine, packrat keeps trying to pull the packages from CRAN, which fails out.  

I've created a local CRAN-like repository, which I can install packages manually from, but packrat seems to ignore it.  I've tried both setting my global repos options to that repo, I've tried changing the repo in the packrate.lock file (or redefining CRAN in packrate.lock) to point to the new repo.   I've tried including the scr files when I bundle it.  Packrat still tries to connect to CRAN.

I feel like this should be very simple to do, but I've read all the packrat examples and packrat help files and I'm stumped.  FWIW, I'm using Rstudio for the project.

Ideas?

-Rebecca

pw...@massmutual.com

unread,
Sep 8, 2017, 4:57:21 PM9/8/17
to packrat-discuss
I want to ask exactly the same question.
Since all the tar files are already in "src" directory, and by default are checked into Github, it seems a waste not to restore from there.

Do we have to write our own script to do this?

Appreciate any help,

Peng

Kevin Ushey

unread,
Sep 8, 2017, 6:04:23 PM9/8/17
to pw...@massmutual.com, packrat-discuss
Hi Peng,

Packrat actually does attempt to install packages from sources when a tarball is available locally in the 'packrat/src' folder. The main exception to this rule is on macOS and Windows (when `options(pkgType = "both")` is set); RStudio will attempt to download a binary from CRAN if one is available (to avoid the overhead of compiling a package from source).

If you want to force Packrat to attempt installation from sources only, you can try setting `options(pkgType = "source")`.

Note that Packrat may still attempt to query the set of available packages on CRAN in this process, even without internet connectivity. This may lead to some spurious warnings during restore; we'll see if we can clean these up.

(It's also possible I'm misunderstanding your query -- can you let me know if I'm missing something?)

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-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pw...@massmutual.com

unread,
Sep 11, 2017, 11:30:04 AM9/11/17
to packrat-discuss
Thank you Kevin. That's exactly what I was asking. Really appreciate!
Thanks,
Kevin

To unsubscribe from this group and stop receiving emails from it, send an email to packrat-discu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages