10

I'm trying to setup a travis build but it fails with the error below:

$ export PKG_TARBALL=$(Rscript -e 'pkg <- devtools::as.package("."); cat(paste0(pkg$package, "_", pkg$version, ".tar.gz"));')
Error in loadNamespace(name) : there is no package called ‘devtools’

My package doesn't need devtools to compile.

I've added devtools to Suggests: in the DESCRIPTION, added it to .travis.yml (see below) be no avail.

language: r
sudo: required
# System dependencies for HTTP calling
apt_packages:
 - libcurl4-openssl-dev
 - libxml2-dev
r_binary_packages:
  - devtools
install:
  - Rscript -e 'install.packages("INLA", repos="http://www.math.ntnu.no/inla/R/stable")'

What am I doing wrong?

Log file of the failing build: https://travis-ci.org/ThierryO/multimput/builds/97625211

Source of the package: https://github.com/ThierryO/multimput/tree/travis

Thierry
  • 18,049
  • 5
  • 48
  • 66
  • Try using Craig Citro's guide [here](https://github.com/craigcitro/r-travis/wiki), many R packages do. I'm surprised that didn't come up in Google... – nrussell Dec 18 '15 at 11:38
  • 1
    I've been using https://docs.travis-ci.com/user/languages/r. It claims to be the official support of R on Travis. It mentions [r-travis](https://github.com/craigcitro/r-travis) under "Converting from r-travis". Therefore I ignored Craig Citro's guide. – Thierry Dec 18 '15 at 12:23
  • I see. I'm sure this can be done by sticking to the official documentation alone, but I think the aforementioned guide / associated scripts will save you a lot of grief (it did for me). FWIW many high profile packages use it (e.g. Rcpp, dplyr, ...), so it will presumably continue to be well-maintained in the future. – nrussell Dec 18 '15 at 13:56
  • Many users reported devtools install errors on the [travis-ci issues list](https://github.com/travis-ci/travis-ci/issues/5650). In a reply, @jimhester recommended using container based builds instead of the old procedure. – Paul Rougieux Feb 18 '16 at 13:39
  • did you ever figure out a fix for this? I am having the same issue with `testthat`. – Eric Feb 14 '18 at 16:24

1 Answers1

7

I'm managed to get it up and running with the .travis.yml according to the official Travis CI documentation. The solution has several components:

  • install devtools manually
  • install CRAN dependencies manually
  • install INLA manually with both the math.ntnu.no and rstudio.com repositories. The second is required because the first has only the INLA packages and not it's dependencies.

Build log

.travis.yml

language: r
sudo: required
install:
  - Rscript -e 'install.packages("devtools", repos = "http://cran.rstudio.com")'
  - Rscript -e 'install.packages(c("plyr", "geepack", "snowfall"), repos = "http://cran.rstudio.com")'
  - Rscript -e 'install.packages("INLA", repos = c("http://www.math.ntnu.no/inla/R/stable", "http://cran.rstudio.com"))'
Thierry
  • 18,049
  • 5
  • 48
  • 66