Error in magick_image_readpath()...
bstaton1 opened this issue · 5 comments
Hello,
I'm very excited about this package, however I haven't been able to get it to work on my machine (see the bottom for the result of sessioninfo::session_info()
.
When I try running this example:
mtcars%>%
head()%>%
knitr::kable("latex")%>%
tex_preview()
I get this error:
Error in magick_image_readpath(enc2native(path), density, depth, strip) :
Magick: PDFDelegateFailed `The system cannot find the file specified.
' @ error/pdf.c/ReadPDFImage/809
I get the same error regardless of what kind of TeX code I pass to tex_preview()
.
I have verified that I have all of the necessary latex packages:
texPreview:::tex_pkgs()
returns
[1] "xcolor" "booktabs" "multirow" "array" "helvet" "amsmath" "rotating" "listings" "graphicx" "setspace" "caption"
and
texPreview:::check_requirments()
returns
xcolor booktabs multirow array helvet amsmath rotating listings graphicx setspace caption
TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
but with 11 warnings, all of the form (one for each package):
1: In system(cmd, intern = intern, wait = wait | intern, ... :
running command 'C:\windows\system32\cmd.exe /c mpm --list-package-names | grep xcolor' had status 255
(side note, I also get these warnings upon library(texPreview)
).
I have also verified that pdflatex is in my PATH variable:
Sys.getenv("PATH")
returns (among other things):
C:\\Users\\bstaton\\AppData\\Roaming\\TinyTeX\\bin\\win32
which is where pdflatex.exe lives. I render .Rmd files to PDF using pdflatex all the time, so I suspect this isn't the issue.
Any suggestions on what could be causing this problem?
Thanks!
Session Info
- Session info ----------------------------------------------------------------------------------------------
setting value
version R version 3.6.0 (2019-04-26)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/Los_Angeles
date 2020-01-08
- Packages --------------------------------------------------------------------------------------------------
package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.6.0)
cli 2.0.1 2020-01-08 [1] CRAN (R 3.6.0)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
digest 0.6.23 2019-11-23 [1] CRAN (R 3.6.1)
fansi 0.4.0 2018-10-05 [1] CRAN (R 3.6.2)
fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.0)
glue 1.3.1 2019-03-12 [1] CRAN (R 3.6.0)
htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.2)
knitr * 1.26 2019-11-12 [1] CRAN (R 3.6.1)
lifecycle 0.1.0 2019-08-01 [1] CRAN (R 3.6.1)
magick 2.2 2019-08-26 [1] CRAN (R 3.6.1)
magrittr * 1.5 2014-11-22 [1] CRAN (R 3.6.0)
pillar 1.4.3 2019-12-20 [1] CRAN (R 3.6.2)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.1)
Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.1)
rematch2 2.1.0 2019-07-11 [1] CRAN (R 3.6.1)
rlang 0.4.2 2019-11-23 [1] CRAN (R 3.6.0)
rstudioapi 0.10 2019-03-19 [1] CRAN (R 3.6.0)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0)
svgPanZoom 0.3.3 2016-09-26 [1] CRAN (R 3.6.1)
texPreview * 1.4.3 2019-12-12 [1] CRAN (R 3.6.2)
tibble 2.1.3 2019-06-06 [1] CRAN (R 3.6.0)
whisker 0.4 2019-08-28 [1] CRAN (R 3.6.2)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.0)
xfun 0.11 2019-11-12 [1] CRAN (R 3.6.2)
xml2 1.2.2 2019-08-09 [1] CRAN (R 3.6.2)
[1] C:/Users/bstaton/Documents/R/R-3.6.0/library
Thank you for trying out the package.
From the magick error it looks like the pdf is not being created in the expected path.
Can you please check if mpm is installed on your system.
I do not know if tinytex installs it by default.
Thank you
This SO link may also be a good direction to try too.
It refers to error 809 in image magick.
The solution there was missing ghostscript.
Thank you for your response. Installing ghostscript was indeed the problem!
I suggest adding this to the system requirements for your package to run.
Good to hear.
We will look into it if this is a magick/pdftools requirement or a tinytex minimal installation that did not install ghostscript on your system.
We will make a note of it in the readme depending on the case.
Closing this issue for now.
ghostscript does not seem to be installed via tinytex on windows
https://github.com/yihui/tinytex/blob/8ab1244bcad3777470defa99a671bc925978d773/R/tlmgr.R#L104_L122
there is a related issue with ghostscript in tinytex issues that has more background on the subject