Managing local packages, what exactly is a "local repository"?

437 views
Skip to first unread message

Scott Ritchie

unread,
Dec 17, 2014, 10:15:13 PM12/17/14
to packrat...@googlegroups.com

The current instructions for managing local packages built from source in both the README on CRAN and the instructions on RStudio’s github page guide the user to set the path to the local repository using packrat::set_opts(local.repos = ...) and then install using packrat::install_local().

After creating a subdirectory of my project folder to be the local repository, this has lead me to try the following:

  1. using packrat::install_local the same way I would use install.packages, e.g.: install_local("myPackage_0.10.4.tar.gz"). After which packrat::status() complains that “No package ‘myPackage’ found in local repositories specified.”
  2. Changing that to install_local("myPackage") which doesn’t work.
  3. Renaming the source to “myPackage.tar.gz”, and repeating (1), giving the same error.
  4. extracting the source package into a new sub-folder myPackage. This works, but I’m not sure if its correct?
  5. I also briefly attempted to create a local repository following the R Administration and Installation Instructions, which I suspect may be the correct solution?

Some clarity in the instructions as to what exactly a “local repository” means would be helpful.

Kevin Ushey

unread,
Dec 18, 2014, 12:10:25 PM12/18/14
to packrat...@googlegroups.com
Hi Scott,

Thanks -- you are correct that the 'local repositories' bit is unclear, and the feature is also not entirely fleshed out. What we call 'local repositories' is a separate entity from 'CRAN-like repositories'.

Perhaps we should call them 'ad-hoc local repositories', to distinguish them from 'CRAN-like local repositories', or something to that effect. But what we call 'ad-hoc local repositories' in Packrat are just directories containing package sources -- in other words, as you noted in step 4. That is the intended use of the feature.

Using a 'real' CRAN-like repository is certainly a better solution, although it would require more work to maintain. The 'local.repos' ad-hoc repository is more for very simple cases where you have a package sources that just live on disk somewhere, and just want to let Packrat know where it lives (and hence available for install).

I'll update the documentation to that effect.

Thanks,
Kevin

Kevin Ushey

unread,
Dec 18, 2014, 1:17:33 PM12/18/14
to packrat...@googlegroups.com
Hi Scott,

I just produced a walkthrough on how to set up your own CRAN-like repository, and how to set up Packrat to understand that repository:


Please take a look and let me know if you have any comments.

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.

David Smith

unread,
Dec 18, 2014, 1:54:12 PM12/18/14
to Kevin Ushey, packrat...@googlegroups.com
Thanks Kevin. You might also want to take a look at the miniCRAN package, which automates much of this process.


# David

-- 
David M Smith <da...@revolutionanalytics.com>
Chief Community Officer, Revolution Analytics  http://blog.revolutionanalytics.com
Tel: +1 (650) 646-9523 (Chicago IL, USA)
Twitter: @revodavid


Revolution R Plus

Subscribe to Technical Support & Indemnification for R

Andrie de Vries

unread,
Dec 18, 2014, 4:37:07 PM12/18/14
to packrat...@googlegroups.com, ke...@rstudio.com
Hi, Kevin

I like your clear overview of the process and would welcome any input in the miniCRAN package - we clearly share the same idea!


I'm working on an update of the package. You can find the latest developments at github, specically at the release branch

library("devtools")
install_github("andrie/miniCRAN", ref="release") 

Regards

Andrie

Kevin Ushey

unread,
Dec 18, 2014, 5:33:11 PM12/18/14
to packrat...@googlegroups.com, ke...@rstudio.com
Hi Andrie,

Thanks! miniCRAN looks like it looks like it will be quite useful. It looks like it's primarily intended for making a (subset of) CRAN available in network-constrained situations -- e.g. making miniCRAN available on a local intranet?

I'm curious to see how it could work as a 'repository management' tool -- e.g. for in-house packages that might be uploaded and 'deployed' to be made for use locally, with automatic archiving of old packages, and so on.

If I get a chance, I'll try to give it a spin and let you know if I have any comments.

Cheers,
Kevin
Reply all
Reply to author
Forward
0 new messages