Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Vignettes with plots won't built with knitr after 1.27 update: there is no package called 'magick' #1796

Closed
3 tasks done
anhtr opened this issue Jan 16, 2020 · 3 comments
Closed
3 tasks done

Comments

@anhtr
Copy link

anhtr commented Jan 16, 2020

Hello,

Thank you for your essential package. I may have found a bug in the 1.27 release of knitr.

My package (HPAanalyze on Bioconductor) build vignette using knitr, and the Travis-CI build has been fine right up to the release of knitr 1.27 (i.e. this morning was ok, this afternoon was not.). I got the error message there is no package called 'magick'. I traced back to the line in the vignette that caused the error, and it was a function that generate plots using ggplot2 and gridExtra.

I think a change in knitr 1.27 may have caused that. The full log is as below. Please let me know what other information I should include. Thank you very much.

https://travis-ci.com/trannhatanh89/HPAanalyze/builds/144784427


Building with: R CMD build 

30.81s$ R CMD build  .

* checking for file ‘./DESCRIPTION’ ... OK

* preparing ‘HPAanalyze’:

* checking DESCRIPTION meta-information ... OK

* installing the package to build vignettes

* creating vignettes ... ERROR

--- re-building ‘a_HPAanalyze_quick_start.Rmd’ using rmarkdown

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Quitting from lines 56-59 (a_HPAanalyze_quick_start.Rmd) 

Error: processing vignette 'a_HPAanalyze_quick_start.Rmd' failed with diagnostics:

there is no package called 'magick'

--- failed re-building ‘a_HPAanalyze_quick_start.Rmd’

--- re-building ‘b_HPAanalyze_indepth.Rmd’ using rmarkdown

Quitting from lines 64-65 (b_HPAanalyze_indepth.Rmd) 

Error: processing vignette 'b_HPAanalyze_indepth.Rmd' failed with diagnostics:

there is no package called 'magick'

--- failed re-building ‘b_HPAanalyze_indepth.Rmd’

--- re-building ‘c_HPAanalyze_case_query.Rmd’ using rmarkdown

Quitting from lines 54-55 (c_HPAanalyze_case_query.Rmd) 

Error: processing vignette 'c_HPAanalyze_case_query.Rmd' failed with diagnostics:

there is no package called 'magick'

--- failed re-building ‘c_HPAanalyze_case_query.Rmd’

--- re-building ‘d_HPAanalyze_case_offline_xml.Rmd’ using rmarkdown

--- finished re-building ‘d_HPAanalyze_case_offline_xml.Rmd’

--- re-building ‘e_HPAanalyze_case_json.Rmd’ using rmarkdown

--- finished re-building ‘e_HPAanalyze_case_json.Rmd’

--- re-building ‘f_HPAanalyze_case_images.Rmd’ using rmarkdown

trying URL 'https://www.proteinatlas.org/ENSG00000134057.xml'

downloaded 1.1 MB

--- finished re-building ‘f_HPAanalyze_case_images.Rmd’

--- re-building ‘z_HPAanalyze_paper_figures.Rmd’ using rmarkdown

--- finished re-building ‘z_HPAanalyze_paper_figures.Rmd’

SUMMARY: processing the following files failed:

  ‘a_HPAanalyze_quick_start.Rmd’ ‘b_HPAanalyze_indepth.Rmd’

  ‘c_HPAanalyze_case_query.Rmd’

Error: Vignette re-building failed.

Execution halted

The command "R CMD build  ." failed and exited with 1 during .

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@yihui yihui changed the title Vignettes with ggplots won't built with knitr after 1.27 update Vignettes with ggplots won't built with knitr after 1.27 update: there is no package called 'magick' Jan 16, 2020
@yihui
Copy link
Owner

yihui commented Jan 16, 2020

Thanks for the report! You may add magick to Suggests in DESCRIPTION, or set knitr::opts_chunk$set(crop = NULL) in your Rmd.

This problem occurs because BiocStyle enabled plot cropping unconditionally for all its output formats:

That means magick needs to be declared as a Suggests dependency in packages that use BiocStyle's non-LaTeX/PDF output formats; knitr 1.27 started to use magick to crop non-PDF images, per suggestion #1785.

In rmarkdown, we only enable cropping in the pdf_document format, and we enable this feature conditionally: https://github.com/rstudio/rmarkdown/blob/3a03ed9368ee54c42eec7302fe33990b193219ef/R/output_format.R#L254 BiocStyle may need to check requireNamespace('magick', quietly = TRUE).

@yihui yihui changed the title Vignettes with ggplots won't built with knitr after 1.27 update: there is no package called 'magick' Vignettes with plots won't built with knitr after 1.27 update: there is no package called 'magick' Jan 16, 2020
@anhtr
Copy link
Author

anhtr commented Jan 16, 2020

Thank you for your answer! Setting knitr::opts_chunk$set(crop = NULL) worked perfectly for me.

@yihui yihui closed this as completed Jan 16, 2020
federicomarini added a commit to federicomarini/pcaExplorer that referenced this issue Jan 18, 2020
yihui added a commit that referenced this issue Jan 20, 2020
kevinrue added a commit to iSEE/iSEE that referenced this issue Jan 24, 2020
kriemo added a commit to rnabioco/clustifyr that referenced this issue Jan 30, 2020
lcolladotor added a commit to leekgroup/regionReport that referenced this issue Apr 24, 2020
…ound taken

This is also an opportunity to link to the relevant GitHub issues and Bioc-devel
threads.

Cropping images through `magick::image_trim()` as done by default by
`BiocStyle::html_document()` can fail on Linux. This could be an ImageMagick
issue or an issue about lack of resources. The full investigative report is at
https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016650.html.
This is related to:
yihui/knitr#1785 (comment)
yihui/knitr#1796
Bioconductor/BiocStyle#65 (comment)
ropensci/magick#171
ropensci/magick#194
In regionReport version 1.21.10 I have opted by using `crop = NULL` to disable
cropping of images by `BiocStyle::html_document()` and thus avoid the
issues with `ImageMagick` either coming from `magick`, from the version of
`ImageMagick` installed on the Linux Bioconductor build machine and devel
docker, or from resources in these two Linux environments as described in the
investigative report.
About a month ago I also saw failures on Windows on Bioc 3.10. Whether they were
caused by ggbio 1.35.1 or this issue will remain a mystery. But it's likely
that this `magick::image_trim()` issue also affected the Bioconductor windows
builder.
The related bioc-devel threads are:
https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016538.html
https://stat.ethz.ch/pipermail/bioc-devel/2020-March/016365.html
@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants