Travis CI cannot find packages in the pkg-config search path - r

I've recently started encountering the same errors on my various R packages updated after mid-December on Travis-CI (https://travis-ci.org/TGuillerme/). This is specially weird since for the three concerned packages, the changes were not any code change (only comments changes) but Travis-CI seems now not able to install some packages (namely magick and libgit2) using a pretty simple .yml file runing the package and codecov for coverage:
language: r
warnings_are_errors: false
branches:
only:
- master
- release
except:
- CRAN
# Code coverage
r_packages:
- covr
after_success:
- Rscript -e 'library(covr); codecov(token = "5f041826-63f1-47fa-b4a8-9a32633f47fa")'
The error I get in this case (although it varies with the different packages) is with the magick package:
** package ‘magick’ successfully unpacked and MD5 sums checked
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lMagick++-6.Q16
line 2625-2631
Along with one suspicious message prior to this:
Unable to find the libgit2 library on this system. Building 'git2r'
using the bundled source of the libgit2 library.
line 1563-1564
Is there something obvious that I am missing? Is there a way to force Travis-CI to automatically install the the errored packages?
Again, this is specially weird to me since the running code changes committed do not differ since last build running without errors.

I have been able to fix similar issues by installing packages from their binaries.
The following might help in the .travis.yml:
r_binary_packages:
- libgit2
- magick

Related

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

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.

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!

Travis-CI: Knitr Not Found in loadVignetteBuilder

I've been using travis-ci successfully so far but I'm having trouble when using travis-ci with R 3.4.0 at the vignette building step with the following error in the "building package" section:
* installing the package to build vignettes
* creating vignettes ... ERROR
Error in loadVignetteBuilder(vigns$pkgdir) :
vignette builder 'knitr' not found
Calls: <Anonymous> -> loadVignetteBuilder
Execution halted
When I run R-CMD-check locally it passes and I don't get any errors
Here's the current .travis.yml
language: R
sudo: false
install:
- R -e "0" --args --bootstrap-packrat
cache:
directories:
- $TRAVIS_BUILD_DIR/packrat/src
- $TRAVIS_BUILD_DIR/packrat/lib
packages: true
r_packages:
- covr
after_success:
- Rscript -e 'library(covr); codecov()'
DESCRIPTION has the vignette line in it:
VignetteBuilder: knitr
knitr is also in my packrat.lock file and packrat is used for the build in .travis.yml.
I've tried the following to no avail:
added knitr to the r_packages in .travis.yml
added knitr to the Imports in DESCRIPTION
added r_check_args: "--no-vignettes" to travis.yml in the hopes of skipping the vignette building step.
added packrat call in travis.yml from install to before_install
I'm pretty knew to building R packages, never mind travis-ci so I'm not sure if I understand why the vignette builder would not have access to the knitr package.
Repo: https://github.com/cormac85/datakindr
Travis: https://travis-ci.org/cormac85/datakindr
One potential problem involves the 'Imports' and/or 'Suggests' sections in your description file.
dplyr needs to be in your suggests, if not imports.
See Hadley's 2015 O'Reilly book, R Packages:
Common problems:
The vignette builds interactively, but when checking, it fails with an error about a missing package that you know is installed. This means that you’ve forgotten to declare that dependency in the DESCRIPTION (usually it should go in Suggests).
So in the end I got the build to pass by just removing packrat config from .travis.yml and replacing it with the normal package building config: cache: packages.
The packrat config I used was suggested in the Travis R Documentation and worked well for the rest of the items in the package but it did not work for the loadVignetteBuilder() step during the build.

Package dependency issue when testing for submissin to CRAN

I am developing an R package for which I wrote some test files using R package testthatand placed the files under tests folder. I ran R CMD build on a Linux machine with R version 3.0.0. The command failed because testthat package requires R version at least 3.1.0.
Two following things I can do, but I am not sure which is better.
I can remove whole things in tests folder, so that my R package will also work for R version less than 3.1.0. As I notice, test files are not required for building an R package. Those are only useful for the developer.
I can keep all test files, but explicitly mention Depends: R (>= 3.1.0) in the DESCRIPTION file. The downside is that: (1) the package will be available to less users; and (2) more important, it depends on testthat package. Whatever updates there might affect my package potentially.
Which one do you think is better?
[update]
I followed the suggestion from # hrbrmstr, which is, I first built the package using R 3.1.0, and then check it on a Linux machine with R 3.0.0. But I still failed. The log is as follows.
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Package suggested but not available: ‘testthat’
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.
Any ideas to fix this issue?Or should I take approach 1 or 2 as stated above?

problem when installing RTextTools for R

I was trying to install RTextTools package for R, but failed. Here is the output from the screen
> > install.packages("RTextTools")
Warning in install.packages("RTextTools") :
argument 'lib' is missing: using 'C:\Users\datamining\Documents/R/win-library/2.10'
--- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.10
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘RTextTools’ is not available
What's the reason for this problem, and how to fix it? Thanks.
There are two distinct, but related, issues:
You are running version 2.10 of R which is two years old. CRAN supports only the current version with pre-built binaries. You could try installing from source.
RTextTools, as can be seen on its CRAN page also requires at least R version 2.13.
So in short: you should upgrade.
I have resolved the issue. I have Download RTextTools From Given Link.

https://cran.r-project.org/src/contrib/Archive/RTextTools/
and copy RTextTools_1.4.2.tar.gz file in project root folder then run this command in project folder in terminal
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
After running this command I receive below error
"ERROR: dependencies ‘SparseM’, ‘randomForest’, ‘tree’, ‘e1071’, ‘ipred’, ‘caTools’, ‘maxent’, ‘glmnet’, ‘tau’ are not available for package ‘RTextTools’".
Now install each dependencies from RStudio or RConsole (Any Editor used by you) by simply running this code.
install.packages("caTools").
Install all 9 required packages One By One (In My Case it was 9 Packages Dependencies required by RTextTools) all packages will be installed except 'maxent'.
Now download maxent from the given link.
https://cran.r-project.org/src/contrib/Archive/maxent/.
and copy maxent_1.3.3.1.tar file in project folder then run this command in project folder in terminal.
"R CMD INSTALL maxent_1.3.3.1.tar"
Now For RTextTools Run this command again in Terminal.
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
All is done Now..
But the Last Step is
Load the RTextTools using.
library(RTextTools)
You will see one more Error: Load SparseM Now Loading SparseM use code below.
library(SparseM)
and in the last Load RTextTools
library(RTextTools)
RTextTools is dependent on a number of packages, most of which require R 2.13+. You should always keep R updated to the latest version, since each update contains numerous bug fixes and performance enhancements.
If you can't install packages from repository or the packages are not available anymore, just follow this steps:
Install.packages("devtools")
check -- library("devtools")
install_github("cran/maxent")
install_github("cran/RTextTools")

Resources