JuliaInterop / JuliaCall

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

RStudio aborting fatal error after julia_setup() in Julia 1.6 #164

Closed rokapre closed 2 years ago

rokapre commented 3 years ago

Hello,

Recently Julia 1.6 was released and I am having problems with JuliaCall and the function julia_setup() in R. RCall in Julia works fine. I am able to point it to the 1.6 binaries and that part works fine but the issue is immediately afterwards RStudio seems to crash. In the terminal with just R (so not RStudio) I get a segmentation fault:

image

Prior to 1.6, JuliaCall was working fine so I don't know why this is happening. Any ideas? Are there alternatives to use Julia within R that work with 1.6?

I am using MacOS Catalina btw

Best,

Rohan

Non-Contradiction commented 3 years ago

Thank you very much for the feedback!

From the error message, it seems that the segfault happens when JuliaCall tries to load the julia dll into R.

I just downloaded julia v1.6.0 on my Windows laptop, and JuliaCall works fine.

> library(JuliaCall)
> julia_setup("C:\\Users\\lch34\\AppData\\Local\\Programs\\Julia-1.6.0\\bin")
Julia version 1.6.0 at location C:\Users\lch34\AppData\Local\Programs\JULIA-~1.0\bin will be used.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.

I will try to test julia 1.6 on linux and MacOS soon to see if I can reproduce the error.

Best, Changcheng

Non-Contradiction commented 3 years ago

I tried on both linux REHL7 system and MacOS Catalina. JuliaCall works okay with Julia 1.6 on REHL7 but the same error as reported happens on MacOS Catalina. I will investigate deeper to see why it happens.

Thanks for the timely report!

jpkrooney commented 3 years ago

I came to report a similar issue on Mac Big Sur (11.2.2). If I run this code:

library(JuliaCall)
julia_setup(JULIA_HOME = "/Applications/Julia-1.6.app/Contents/Resources/julia/bin/")

RStudio (1.4.1103) crashes:

Screenshot 2021-03-27 at 14 26 01
rokapre commented 3 years ago

Wondering if there are any updates on this issue. I tried again today after installing JuliaCall again, but I ran into the same problem. Are there any other ways right now to call Julia in R?

ihnorton commented 3 years ago

A work-around is to change the process directory to the libjulia path before calling jl_init: https://discourse.julialang.org/t/segfault-when-jl-init-in-r-also-python-with-julia-1-6-on-macos/58110/5?u=ihnorton