Skip to content

Instantly share code, notes, and snippets.

@zkamvar
Last active August 29, 2015 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zkamvar/c3ecc332353fcbf205f6 to your computer and use it in GitHub Desktop.
Save zkamvar/c3ecc332353fcbf205f6 to your computer and use it in GitHub Desktop.
r-devel docker to test poppr

Notes for working with docker to test poppr on R-devel

I recently got an email from Kurt Hornik from CRAN stating that a single line of code was causing poppr to fail in R-devel. Since installing R-devel is a pain on OSX, I decided to use a docker container. Ted Hart has a good blog on it here.

On mac, I followed the instructions to install docker starting here.

I ran this once and have never had to run it again:

boot2docker init

Process:

First, open two terminal windows in the same directory and then run:

boot2docker start
eval "$(boot2docker shellinit)"

From here, these are modifications of Hart's blog.

First, start the r-devel docker container:

UPDATE: Use this, and skip the next two code chunks (yes, I know, poppr is no longer a "short script").

docker pull rocker/r-devel; \
docker run --rm -ti -v $(pwd):/poppr rocker/r-devel bash

docker run -ti --rm  rocker/r-devel /bin/bash

In the other window, run these commands, but change backstabbing_feynman to whatever the name of the docker container is. Note that this is assuming you are one directory above the poppr repository.

eval "$(boot2docker shellinit)"; \
docker ps; \
dockervar=backstabbing_feynman; \ # Change this to your docker container name
docker exec -i $dockervar bash -c 'mkdir /RSource'; \
tar -cv poppr | docker exec -i $dockervar tar x -C /RSource; \

When I come to the point of building and testing my package, I first install all of the packages that normally come with R to the global library (i.e. lattice. See this help thread for details). I then install devtools and try to install all of the dependencies (from within the container):

UPDATE 2015-06-29

libxml and libssl have been a pain in the ass lately. They were never installing correctly. Finally, I found out that they are trying to fix these issues: rocker-org/rocker#124, so currently the best way to do this is to install the "unstable" versions.

apt-get update; \
apt-get install -t unstable libxml2-dev; \
apt-get install -t unstable libssl-dev; \
RD -e "install.packages(c('MASS', 'lattice', 'nlme', 'mgcv', 'Matrix', 'boot', 'cluster'), .Library, repos = 'http://cran.rstudio.org')"; \
RD -e 'install.packages("devtools", repos = "http://cran.rstudio.org"); devtools::install_deps("poppr/", dependencies = TRUE)'; 

The first three lines are to install libxml and OpenSSL because of various issues that pop up.

When testing with version 2.0:

RD -e 'devtools::install_github(c("thibautjombart/adegenet", "emmanuelparadis/pegas/pegas", "klausvigo/phangorn"))'

The rest is following the instructions in Hart's blog.

After testing, in the non-docker shell:

docker commit -m "set up poppr dependencies" b8e911f0a6bb rocker/r-devel:poppr-deps

And now I can open the container with

docker run -ti --rm  rocker/r-devel:poppr-deps /bin/bash

And it will have the folder linked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment