JuliaInterop / JuliaCall

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

`julia_setup()` cannot find `libjulia.1.dylib` when Julia is installed via `juliaup` #184

Open gadenbuie opened 2 years ago

gadenbuie commented 2 years ago

I've also run into the issues described in https://github.com/JuliaLang/juliaup/issues/262

Here's what I did on macOS on a machine where Julie was not yet installed:

brew install juliaup
juliaup add release
#> Installing Julia 1.7.2+0 (x64).

Then when trying to knit an Rmd with a julia engine, I see the equivalent of the following (edited for readability).

JuliaCall:::julia_setup()
#> Julia version 1.7.2 at location /Users/garrick/.julia/juliaup/julia-1.7.2+0~x64/bin will be used.
#> ERROR: could not load library "libjulia.1.dylib"
#> dlopen(libjulia.1.dylib, 0x0001): tried: 
#> '/Users/garrick/.julia/juliaup/julia-1.7.2+0~x64/lib/julia/libjulia.1.dylib' (no such file), 'libjulia.1.dylib' (no such file), 
#> '/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libjulia.1.dylib' (no such file), 
#> '/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjulia.1.dylib' (no such file), 
#> '/Users/garrick/libjulia.1.dylib' (no such file)

In RStudio this causes a segfault.

fazepher commented 2 years ago

I was also having this issue but I was able to do the setup after installing the development version via devtools::install_github("Non-Contradiction/JuliaCall")

Non-Contradiction commented 2 years ago

@fazepher Thanks for the feedback! I will try to release the development version on CRAN soon. @gadenbuie Would you check if the development version solves the problem?

Faraz564 commented 1 year ago

I have encounter the following after updating R-studio. Currently I have reinstalled R, S-Studio (4.3.1) and julia (1.9). But the troubble is remaine the same as after updating the software. So kindly see the isuue below and suggest me something JuliaCall

gadenbuie commented 1 year ago

Just to confirm, I also see the same error as @Faraz564 when I run the reprex code in my OP:

JuliaCall:::julia_setup()
#> Julia version 1.9.1 at location /Users/garrick/.julia/juliaup/julia-1.9.1+0.aarch64.apple.darwin14/bin will be used.
#> Loading setup script for JuliaCall...
#> LoadError("/Users/garrick/Library/R/arm64/4.3/library/JuliaCall/julia/setup.jl", 16, LoadError("/Users/garrick/Library/R/arm64/4.3/library/JuliaCall/julia/JuliaObject.jl", 75, ErrorException("syntax: Global method definition around /Users/garrick/Library/R/arm64/4.3/library/JuliaCall/julia/JuliaObject.jl:77 needs to be placed at the top level, or use \"eval\"."))) Error in .julia$cmd(paste0(Rhomeset, "Base.include(Main,\"", system.file("julia/setup.jl",  :
#>   Error happens when you try to execute command ENV["R_HOME"] = "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources";Base.include(Main,"/Users/garrick/Library/R/arm64/4.3/library/JuliaCall/julia/setup.jl") in Julia.
#>                         To have more helpful error messages,
#>                         you could considering running the command in Julia directly
FabianBarrett commented 1 year ago

@gadenbuie @Faraz564 I'm also seeing the same issue with the same error message. Some guidance would very much be appreciated, @Non-Contradiction.

vh94 commented 1 year ago

I ran into the same issue using JuliaCall version 0.17.5, R version 4.1.2, Julia 1.8.5. Installing the github version of JuliaCall with all dependencies resolved the issue for me.

FabianBarrett commented 1 year ago

@vh94 Thank you for the pointer; installing via devtools::install_github("Non-Contradiction/JuliaCall") also resolved the issue for me.

Shafique313 commented 1 year ago

I was also having this issue but I was able to do the setup after installing the development version via devtools::install_github("Non-Contradiction/JuliaCall")

Hi could you please share the code how you solve this error, How you change the version? Thank You