Open DanielBonnery opened 3 years ago
sudo apt-get install r-cran-tikzdevice
solved the issue...
That is expected since the graphics API has changed. Which version of tikzDevice did you use before?
I installed with devtools the master branch and I got the same issue with R version 4.1.0. With the previous version (R 4.0.5) I constructed succesfully the master branch. I need the master branch in order to use knitr + tikzDevice using child documents and cutom *.cls classes.
> print(sessionInfo())
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
locale:
[1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8
[5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8 LC_PAPER=es_ES.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0
Installing the package from the cran repository seems to work but I can't build from the repository correctly.
I tried to buid the package with the following options:
The 3 options get the same result when I run a .Rnw with tikzplots:
*** caught segfault ***
address (nil), cause 'memory not mapped'
Traceback:
1: .setMask(NULL, NULL)
2: resolveMask.NULL(NULL)
3: (function (path) { UseMethod("resolveMask")})(NULL)
4: grid.newpage()
5: print.ggplot(p)
6: print(p)
7: print(p)
8: printTikz(p1$plot, cwd)
9: eval(expr, envir, enclos)
10: eval(expr, envir, enclos)
11: withVisible(eval(expr, envir, enclos))
12: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)
13: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, error = eHandler, message = mHandler))
14: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
15: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, debug = debug, last = i == length(out), use_try = stop_on_error != 2L, keep_warning = keep_warning, keep_message = keep_message, output_handler = output_handler, include_timing = include_timing)
16: evaluate::evaluate(...)
17: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message), stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 0L else 2L }, output_handler = knit_handlers(options$render, options))
18: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message), stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 0L else 2L }, output_handler = knit_handlers(options$render, options)))
19: eng_r(options)
20: block_exec(params)
21: call_block(x)
22: process_group.block(group)
23: process_group(group)
24: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { setwd(wd) cat(res, sep = "\n", file = output %n% "") message("Quitting from lines ", paste(current_lines(i), collapse = "-"), " (", knit_concord$get("infile"), ") ") })
25: process_file(text, output)
26: knit(..., tangle = opts_knit$get("tangle"), envir = envir)
27: FUN(X[[i]], ...)
28: lapply(sc_split(params$child), knit_child, options = block$params)
29: call_block(x)
30: process_group.block(group)
31: process_group(group)
32: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { setwd(wd) cat(res, sep = "\n", file = output %n% "") message("Quitting from lines ", paste(current_lines(i), collapse = "-"), " (", knit_concord$get("infile"), ") ") })
33: process_file(text, output)
34: knit("main.Rnw", encoding = "UTF-8")
An irrecoverable exception occurred. R is aborting now ...
I'm facing the same issue. The first function will run and the second fails, so I suspect there is something wrong with ggplot2?
tikzDevice::tikz("example.tex"); plot(mtcars[["mpg"]]); dev.off()
tikzDevice::tikz("example2.tex"); ggplot2::qplot(mtcars[["mpg"]]); dev.off()
This, however does work!!
tikzDevice::tikz("example2.tex"); plot(cowplot::as_grob(ggplot2::qplot(mtcars[["mpg"]]))); dev.off()
I have finally merged PR #206 which should fix this issue. Can you please recheck?
My comment works for me! That's fantastic, thanks @rstub
Seg fault.
lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.2 LTS Release: 20.04 Codename: focal
`R
R version 4.1.0 (2021-05-18) -- "Camp Pontanezen" Copyright (C) 2021 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.
[Previously saved workspace restored]
caught segfault address (nil), cause 'memory not mapped'
Traceback: 1: .setMask(NULL, NULL) 2: resolveMask.NULL(NULL) 3: (function (path) { UseMethod("resolveMask")})(NULL) 4: grid.newpage() 5: print.ggplot(x) 6: (function (x, ...) UseMethod("print"))(x)
Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace `