"There is no package called" 'shiny'" despite it's in DESCRIPTION

I wonder if anyone can help me with a travisCI build for an R package I’m writing, named ‘argoFloats’, that uses the ‘shiny’ package.

A sample failed build is at https://travis-ci.org/github/ArgoCanada/argoFloats/builds/728933817

Near the end, the transcript says that it cannot load ‘shiny’, but earlier on, I see that its source was downloaded and built without difficulty. These steps are detailed more in the snippets below, from the above-stated URL.

Snippet 1 from log

trying URL 'http://cloud.r-project.org/src/contrib/shiny_1.5.0.tar.gz'
    Content type 'application/x-gzip' length 3472148 bytes (3.3 MB)
    ==================================================
    downloaded 3.3 MB

Snippet 2 from log

    * installing *source* package ‘shiny’ ...
    ** package ‘shiny’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation
    path
    * DONE (shiny)

Snippet 3 from log

    Error in loadNamespace(name) : there is no package called ‘shiny’
    Error: unable to load R code in package ‘argoFloats’
    Execution halted
    ERROR: lazy loading failed for package ‘argoFloats’

Try installing the devtools package from CRAN and use install_dev("package name"). See if that changes anything for you.

-Montana
Travis CI Staff

I know this is an imposition, but is there any chance of a hint on doing these two things? I find travisCI a bit mystifying, and have been fiddling with different ways to install devtools within my yml file. Listing it in r_packages does not seem to make it available to a install: item that I tried adding. At the moment I have as below, but I’m basically just making guesses and, I fear, wasting watt-hours on the travisCI servers.

# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

language: R
warnings_are_errors: false
cache: packages
after_success: travis_wait 30 Rscript -e 'library(covr); codecov(type="all")'

addons:
    apt:
        packages:
            - libgdal-dev
            - libudunits2-dev
            - libnetcdf-dev
            - netcdf-bin
install:
  - R -e 'install.packages("devtools")'
  - R -e 'devtools::install_deps(dependencies=TRUE)'

r_packages:
    - devtools
    - shiny
    - shinycssloaders
    - marmap
    - ncdf4
    - oce
    - ocedata
    - rgdal
    - sf
    - covr
env:
    global:
        - _R_CHECK_FORCE_SUGGESTS_=False
        - _R_CHECK_CRAN_INCOMING_=False

Your package has shiny only in Suggests but uses it as a build time dependency (https://github.com/ArgoCanada/argoFloats/blob/dda076c35abedb395395e65fcde1b7ab747b1512/R/mapApp.R#L14).

You need to put shiny in Imports.

Thanks, @jimhester. I’ve got it working now. I appreciate the help. Dan.

Imprint