JuliaInterop / JuliaCall

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

versioninfo not defined #190

Open sje30 opened 2 years ago

sje30 commented 2 years ago
Session Info ```r sessionInfo() R version 4.2.1 (2022-06-23) Platform: aarch64-apple-darwin21.6.0 (64-bit) Running under: macOS Monterey 12.6 Matrix products: default BLAS: /opt/homebrew/Cellar/openblas/0.3.21/lib/libopenblasp-r0.3.21.dylib LAPACK: /opt/homebrew/Cellar/r/4.2.1_4/lib/R/lib/libRlapack.dylib locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] JuliaCall_0.17.5 loaded via a namespace (and not attached): [1] compiler_4.2.1 tools_4.2.1 Rcpp_1.0.8.3 knitr_1.39 xfun_0.31 > ```

Here is a reproducible example:

R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
...

> setwd('/Users/stephen')
> require(JuliaCall)
Loading required package: JuliaCall
> julia_setup()
Julia version 1.8.2 at location /opt/homebrew/Cellar/julia/1.8.2/bin will be used.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.
> julia_eval("versioninfo()")
Error: Error happens in Julia.
UndefVarError: versioninfo not defined
Stacktrace:
 [1] top-level scope
   @ none:1
 [2] eval
   @ ./boot.jl:368 [inlined]
 [3] eval_string(x::String)
   @ Main.JuliaCall ~/NOBACKUP/RLIB/JuliaCall/julia/setup.jl:203
 [4] docall(call1::Ptr{Nothing})
   @ Main.JuliaCall ~/NOBACKUP/RLIB/JuliaCall/julia/setup.jl:0
> julia_eval("x=rand(3)")
[1] 0.09482282 0.88495533 0.86962905
> julia_eval("versioninfo()")
Error: Error happens in Julia.
UndefVarError: versioninfo not defined
Stacktrace:
 [1] top-level scope
   @ none:1
 [2] eval
   @ ./boot.jl:368 [inlined]
 [3] eval_string(x::String)
   @ Main.JuliaCall ~/NOBACKUP/RLIB/JuliaCall/julia/setup.jl:203
 [4] docall(call1::Ptr{Nothing})
   @ Main.JuliaCall ~/NOBACKUP/RLIB/JuliaCall/julia/setup.jl:0

If I drop into the console, the function works fine.

> julia_console()
Preparing julia REPL, press Ctrl + D to quit julia REPL.
You could get more information in how to use julia REPL at <https://docs.julialang.org/en/stable/manual/interacting-with-julia/>
...
┌ Warning: Terminal not fully functional
└ @ Base client.jl:410
MethodError: no method matching setup_interface(::REPL.BasicREPL)
Closest candidates are:
  setup_interface(!Matched::REPL.LineEditREPL; hascolor, extra_repl_keymap) at /opt/homebrew/Cellar/julia/1.8.2/share/julia/stdlib/v1.8/REPL/src/REPL.jl:908
  setup_interface(!Matched::REPL.LineEditREPL, !Matched::Bool, !Matched::Any) at /opt/homebrew/Cellar/julia/1.8.2/share/julia/stdlib/v1.8/REPL/src/REPL.jl:911
julia> 
julia> versioninfo()
Julia Version 1.8.2
Commit 36034abf26 (2022-09-29 15:21 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.6.0)
  CPU: 10 × Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 1 on 8 virtual cores
Environment:
  DYLD_FALLBACK_LIBRARY_PATH = /opt/homebrew/Cellar/r/4.2.1_4/lib/R/lib
sje30 commented 1 year ago

Another example:

require(JuliaCall)
Loading required package: JuliaCall
> julia_eval("subtypes(Number)")
Julia version 1.8.2 at location /opt/homebrew/Cellar/julia/1.8.2/bin will be used.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.
Error: Error happens in Julia.
UndefVarError: subtypes not defined
Stacktrace:
 [1] top-level scope
   @ none:1
 [2] eval
   @ ./boot.jl:368 [inlined]
 [3] eval_string(x::String)
   @ Main.JuliaCall ~/NOBACKUP/RLIB/JuliaCall/julia/setup.jl:203
 [4] docall(call1::Ptr{Nothing})
   @ Main.JuliaCall ~/NOBACKUP/RLIB/JuliaCall/julia/setup.jl:0
> 

whereas in Julia:

julia> subtypes(Number)
2-element Vector{Any}:
 Complex
 Real
sje30 commented 1 year ago

This still seems to be a problem with Julia 1.9.0 on Mac.