I am looking into
packrat as a way of keeping things from breaking when updating / installing packages for a particular project. A typical situation would be that a new package needs to be installed but requires some dependencies to be upgraded / installed, which then will break existing code. It is particularly common with
Biocondiuctorpackages. It is also an issue for us because quite some projects take years before completion, sometimes spanning several R / BioC versions.
What did I actually do? Bundle creation:
- on my local computer (OSX, fresh install), installed
R 3.6and multiple R and
- Started a new project with
- Created a snapshot with
- And finally a bundle with
packrat::bundle(), which I think includes all package sources as well.
- On a server,
R version 3.5.1and
CentOS Linux 7, I unbundle the bundle and got the following error
> packrat::unbundle("test_packrat-2019-06-11.tar.gz", "./") - Untarring 'test_packrat-2019-06-11.tar.gz' in directory '/lustre/projects/bioinfo/domingue/scripts'... - Restoring project library... Installing BH (1.69.0-1) ... OK (built source) Installing BiocGenerics (0.30.0) ... Error: Command failed (1) Failed to run system command: '/sw/apps/r/3.5.1/lib64/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmpvUnPCU/BiocGenerics' --library='/lustre/projects/bioinfo/domingue/scripts/test_packrat/packrat/lib/x86_64-pc-linux-gnu/3.5.1' --install-tests --no-docs --no-multiarch --no-demo The command failed with output: ERROR: this R is version 3.5.1, package 'BiocGenerics' requires R >= 3.6.0 In addition: Warning message: In restore(project = getwd(), restart = FALSE) : The most recent snapshot was generated using R version 3.6.0
So as far as I can tell I am running into an issue, sort of unsurprisingly, of
R / BioC packages not compiling in a different R version.
The questions are now:
- How to overcome this issue short of creating a docker container for every project?
- Is there a better way of keeping R workflows from breaking when R or it's packages are updated? I am thinking something like
virtualenvsin python would work (python + packages for each project), but I am not sure something like this exists in R.
Regarding 2, I am guessing snapshots will tell me which version the packages where before updating, but I don't know if it would be easy to restore in case of an R update.