0

When adding a tikz picture environment in bookdown, my Travis CI build stops working.

Here is the error.

Error in loadNamespace(name) : there is no package called 'magick'
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
The command "Rscript -e 'bookdown::render_book("index.Rmd")'" exited with 1.

I tried adding the magick package to my DESCRIPTION file like this:

- Imports: 
    bookdown,
    magick

or like that

- Remotes:
    ropensci/magick

My build is still not working.

The easiest way to reproduce the problem is to clone the repo bookdown_travis. When building the book in RStudio, everything works but I receive an error message on Travis CI.

The problem is in the 07-tikz.Rmd file. This file contains a minimal tikz example that should be working.

Thanks in advance for your help.

Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75
  • I receive this error message: The command "Rscript -e 'deps <- remotes::dev_package_deps(dependencies = NA);remotes::install_deps(dependencies = TRUE);if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages()), collapse=", ")); q(status = 1, save = "no")}'" failed and exited with 1 during . – Marc-André Désautels May 23 '19 at 17:05

2 Answers2

2

Looking at the actual build logs we see:

------------------------- ANTICONF ERROR ---------------------------
Configuration failed because Magick++ was not found. Try installing:
 - deb: 'libmagick++-dev' (Debian, Ubuntu)
 - rpm: 'ImageMagick-c++-devel' (Fedora, CentOS, RHEL)
 - csw: 'imagemagick_dev' (Solaris)
On MacOS it is recommended to use install ImageMagick-6 from homebrew
with extra support for fontconfig and rsvg rendering:
   brew reinstall imagemagick@6 --with-fontconfig --with-librsvg
For older Ubuntu versions Trusty (14.04) and Xenial (16.04) use our PPA:
   sudo add-apt-repository -y ppa:opencpu/imagemagick
   sudo apt-get update
   sudo apt-get install -y libmagick++-dev
If Magick++ is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a Magick++.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------

Since Travis CI uses Xenial, you should use

addons:
  apt:
    sources:
    - sourceline: 'ppa:opencpu/imagemagick'
    packages:
    - libmagick++-dev

in .travis.yml. You will probably have to repeat this process for other packages that require system libraries.

Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75
  • I did what you just proposed and my buils is still not working. Here is the error message : Error in loadNamespace(name) : there is no package called 'pdftools' Calls: ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart Execution halted The command "Rscript -e 'bookdown::render_book("index.Rmd")'" exited with 1. – Marc-André Désautels May 23 '19 at 17:31
  • @Marc-AndréDésautels `pdftools` also requires system libraries. The full error message should tell you which one you need. – Ralf Stubner May 23 '19 at 17:34
  • Thanks for your help, I will look at the full error message. – Marc-André Désautels May 23 '19 at 17:36
2

After the help from @Ralf Stubner, here is the code I have to add to my .travis.yml file to make it work:

addons:
  apt:
    sources:
    - sourceline: 'ppa:opencpu/imagemagick'
    - sourceline: 'ppa:opencpu/poppler'
    packages:
    - libmagick++-dev
    - libpoppler-cpp-dev