JuliaInterop / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
267 stars 36 forks source link

EXCEPTION_ACCESS_VIOLATION after Rmd with Julia chunk knits to html #191

Closed JMLuther closed 1 year ago

JMLuther commented 1 year ago

Getting this report after generating html from a very basic Rmarkdown file that includes a Julia code chunk- I am not sure if this is a JuliaCall, knitr or RStudio issue...but i think it could be related to JuliaCall knitr support. Possibly a clue- html document is actually generated fine- the document preview in RStudio that usually opens fails to appear. The code block runs interactively in Rmd without error. My example includes a plot- this error DOES still occur if just a very basic block is included (eg sqrt(2))

the warning is repeated many more times...same each time so just copied a couple

Using RStudio 2022.07.2 Build 576, which appears to bundle the most recent pandoc version 2.19.2 (2022-08-22)

Output created: basic-julia-rmd.html
Julia exit.

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ff89fa217c0 -- RtlVirtualUnwind at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
in expression starting at none:0

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ff89fa217c0 -- RtlVirtualUnwind at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
in expression starting at none:0

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ff89fa217c0 -- RtlVirtualUnwind at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line)
in expression starting at none:0

my basic reproducible Rmd text:

---
title: "basic julia rmd file"
output: html_document
---

```{r message=FALSE, warning=FALSE}
library(JuliaCall)
# RCall.jl must be installed in Julia for 
julia_setup(JULIA_HOME = "C:/.../Programs/Julia-1.8.2/bin") # path edited just to hide it
using Plots
using RDatasets
mtcars = dataset("datasets", "mtcars");
scatter(mtcars.Disp, mtcars.MPG)

Session info:

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                           LC_TIME=English_United States.utf8    
system code page: 65001

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] knitr_1.40       ggplot2_3.4.0    JuliaCall_0.17.5
JMLuther commented 1 year ago

I'm also noting inconsistency in when the error occurs, even with same Rmd code. I tried with a simpler plot with generated data- no error on the first time I knit, but without any changes it does error.

using Plots
x = [1:1:10]
y = [101:1:110]
scatter(x, y)
JMLuther commented 1 year ago

updated to Julia 1.8.3, still get same error.

based on another reported issue in Rstudio and apparent workaround, I wonder if this is an Rstudio/pandoc compatability issue but I haven't had a chance to load an older pandoc version to try:

JMLuther commented 1 year ago

Since this error message occurs intermittently, I'm not entirely sure, but I think the error can be avoided by changing the julia_setup() command.

Add rebuilld = TRUE' to the setup command-julia_setup(JULIA_HOME = "...Programs/Julia-1.8.3/bin", rebuild = T) This doesn't add much time to the setup on my machine anyways.

I have run this several times and it no longer errors. Will close if this holds up.