R package dependency error on travis-ci but not local machine - r

I am trying to build my first R package (GitHub link). It is currently passing all local checks with devtools::check(), but failing on Travis:
ERROR: dependency ‘Rmpfr’ is not available for package ‘streamDepletr’
Looking at the Installed package versions section of the travis-ci output, Rmpfr is not listed. However, my DESCRIPTION file includes it as an import:
Imports:
Rmpfr,
dplyr,
magrittr
and Rmpfr is available on CRAN; my question is, how do I get travis-ci to install it?
The solution may be related to this previous question where the author had to include Java in their .travis.yml file. For Rmpfr, it looks like the MPFR C library is necessary. Is there a way to instruct travis to install this library in my .travis.yml file? Or am I barking up the wrong tree?

As you found out, you need the libmpfr-dev package to be installed. You can do this by adding
addons:
apt:
packages:
- libmpfr-dev
to your .travis.yml. See the documentation for reference.

Related

R Package Dependency in Github via Remotes not working

I'm developing an R package in Github (ConceptionTools) that depends on another R package (CreateFlowChart), also in Github. I have followed the instructions for defining remote dependencies. My DESCRIPTION file includes:
Imports: CreateFlowChart
Remotes: github::IMI-ConcePTION/CreateFlowChart
However, when I install my package, with the command:
devtools::install_github("IMI-ConcePTION/ConceptionTools")
This dependency is not installed. I simply get "skipping 1 packages not available: CreateFlowChart". It doesn't appear to be trying to use the Remote, since there is no error related to Github.
When I install the dependency directly, that works:
devtools::install_github("IMI-ConcePTION/CreateFlowChart")
Does anybody have any idea of what could be going on here? I'm racking my brain, as it seems to be a quite straightforward case of what the documentation shows. I'm using R 4.0.3 (on Windows 10) and devtools 2.3.2.
There was a typo in the name of the dependency package in its DESCRIPTION file.
This does not make the package fail when installing it directly, but it leads devtools not to find it as a dependency.

Use GitHub Package R Actions

I was trying to use actions in a package I wrote. The issue is that the package actions uses remotes in its setup to install CRAN only packages.
Since the package I am working on depends on a non CRAN package that is present on GitHub, both coverage and R CMD checks fail. I tried to avoid this by naively downgrading to an earlier version of the package in depends but some functions are not exported. I am wondering if someone knows a workaround that might help(I cannot open an issue at actions since their support.md file discourages this).
If your package depends on a non-CRAN package, you must include under Remotes: rather than just Imports: in your DESCRIPTION file. Here you would have:
Imports:
actions
Remotes:
r-lib/actions
This will pass checks, but there is no work around for publishing to CRAN if any of your dependencies are not on CRAN, thus you'll get a warning if any packages are present in the Remotes field.
The alternative using Travis is adding r_github_packages: r-lib/actions to your .travis.yml.
After some time, I have found a workaround that for now is good enough if you want to test for the development version(like I wanted). You should include an install_github command in the check.yaml file. Here's an example:
- name: Install dependencies
run: |
install.packages(c("remotes","testthat"),dependencies=TRUE)
remotes::install_github("tidyverse/dplyr")
remotes::install_cran("covr")
shell: Rscript {0}
The above snippet fixed my issue because I wanted to depend on a future dplyr version. You can view the full yaml file here.

R Travis CI error: Package suggested but not available: ‘ridge’

I am trying to run Travis CI for one of my R packages. The problem is the build fails with an error stating that one dependency of the package is not available (the package named 'ridge')
Here the error log:
* checking extension type ... Package
* this is package ‘imputeR’ version ‘2.1’
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Package suggested but not available: ‘ridge’
The suggested packages are required for a complete check.
Checking can be attempted without them by setting the environment
variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
manual.
* DONE
Status: 1 ERROR
See
‘/home/travis/build/SteffenMoritz/imputeR/imputeR.Rcheck/00check.log’
for details.
0.38schecking package dependencies ... ERROR
Package suggested but not available: ‘ridge’
Here is also the link to the Travis built:
https://travis-ci.org/SteffenMoritz/imputeR/builds/436334069
The package that is not available to Travis is a normal package that is currently on CRAN. Could this be related to Gnu Scientific Library version >= 1.14 being required for ridge..? Can I somehow solve this problem?
You are right by saying that it is because ridge requires an external library (Gnu Scientific Library) that is not installed by default on travis.
Travis CI docs explain in detail how you can install external packages.
In your case, you need to add
addons:
apt:
packages: libgsl0-dev
to your .travis.yml
Found a solution that let's at least TRAVIS complete the check
You can add this to the Travis configuration yaml file:
env:
global:
- _R_CHECK_FORCE_SUGGESTS_: false
Downside as far as I understand is: everything which includes suggested packages is not checked at all. So the solution is not completely satisfying.

Error using Travis CI with R package: 'roxygen2' >= 5.0.0 must be installed for this functionality

I am trying to use Travis CI with an R package (specifically this in-development package here).
When I update a repository, I get the following message (see the logs here):
Error: processing vignette 'comparing-mclust-and-mplus-output.Rmd' failed with diagnostics:
'roxygen2' >= 5.0.0 must be installed for this functionality.
Execution halted
This is consistent across two different packages--although the version of roxygen2 that I have is 6.0.1. I haven't been able to find others with this particular issue on either Stack Overflow or the roxygen2 GitHub page. I used usethis::use_travis() to set up the package for use with Travis (i.e., add travis.yml file.
Any ideas about how to address this?
So I believe the problem you have is with your DESCRIPTION file. Travis will install all package dependencies before trying to build the package / vignettes, so the version you have installed locally is of no consequence.
Rather, you need to be sure that roxygen2 is a dependency of your package (probably only needed in Suggests if it is necessary to build but not use your package). So adding:
Suggests:
roxygen2
To your DESCRIPTION file should fix the issue!

How to force devtools to install packages in remotes

devtools package introduces a nice concept of adding dependancies not available in CRAN, into DESCRIPTION file (described in the vignette). However, I have not been able to figure out how to get it to install the dependancies automatically. The vignette linked above certainly hints that is possible and the install command certainly parses for the "remote" (got an error when they were not specified correctly), however, it only installed dependancies from CRAN. Anybody has ideas if there are some parameters I should specify to make the installation automatic?
Thusfar, I have tried install, install_bitbucket and install_local. install managed to download all the dependancies available in CRAN. install_bitbucket did the same and install_local just did not work at all.
The Remotes: field is used to tell devtools where to look for the packages that are listed in the standard Depends:, Imports: and Suggests:.
So make sure that you have the package listed in the appropriate standard field, and its source listed in Remotes. Then running the following should install these packages from the Remotes source:
devtools::install_deps()

Resources