JuliaInterop / RCall.jl

Call R from Julia
Other
318 stars 59 forks source link

default packages cannot be found #488

Closed Xiaojun928 closed 4 months ago

Xiaojun928 commented 1 year ago

Hi,

I installed R-4.3.0 with the command sudo ./configure --enable-R-shlib --with-readline=no which makes the libR.so available for julia.

Then I installed the RCall.jl successfully in julia, but the warnings below were reported when I running using RCall:

Warning: RCall.jl: During startup - Warning messages:
│ 1: package "methods" in options("defaultPackages") was not found
│ 2: package ‘utils’ in options("defaultPackages") was not found
│ 3: package ‘grDevices’ in options("defaultPackages") was not found
│ 4: package ‘graphics’ in options("defaultPackages") was not found
│ 5: package ‘stats’ in options("defaultPackages") was not found
│ 6: package ‘methods’ in options("defaultPackages") was not found
└ @ RCall ~/.julia/packages/RCall/LWzAQ/src/io.jl:172

The above packages are default packages in R, but they cannot be found. May I know if I should change the command in the configure step to make julia find the R packages?

Thanks in advance for any advice you can offer.

Best, Xiaojun

Xiaojun928 commented 1 year ago

I found a possible solution in this issue #427, but it does not work for me.

I tried julia_setup(JULIA_HOME = "/home-user/software/julia-1.5.4/bin",verbose=TRUE,rebuild = TRUE,install=FALSE) as Sys.getenv("JULIA_HOME") returns "". Below is the output of above command:

Julia version 1.5.4 at location /home-user/software/julia-1.5.4/bin will be used.
Loading setup script for JuliaCall...
sh: line 1: 154784 Segmentation fault      '/home-user/software/julia-1.5.4/bin/julia' '--startup-file=no' '/home-user/xjwang/R/x86_64-pc-linux-gnu-library/4.3/JuliaCall/julia/rebuildRCall.jl' '/usr/local/lib64/R' 2>&1

signal (11): Segmentation fault
in expression starting at /home-user/xjwang/R/x86_64-pc-linux-gnu-library/4.3/JuliaCall/julia/setup.jl:80
GetNewPage at /home-user/xjwang/R/R-4.3.0/src/main/memory.c:1003
Rf_allocVector3 at /home-user/xjwang/R/R-4.3.0/src/main/memory.c:2666
Rf_allocVector at /home-user/xjwang/R/R-4.3.0/src/main/../../src/include/Rinlinedfuns.h:595 [inlined]
Rf_ScalarInteger at /home-user/xjwang/R/R-4.3.0/src/main/../../src/include/Rinlinedfuns.h:1002
__init__ at /home-user/xjwang/.julia/packages/RCall/LWzAQ/src/setup.jl:189
unknown function (ip: 0x7fbce67887d1)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2231 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2398
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1691 [inlined]
jl_module_run_initializer at /buildworker/worker/package_linux64/build/src/toplevel.c:74
jl_init_restored_modules at /buildworker/worker/package_linux64/build/src/dump.c:2541
_include_from_serialized at ./loading.jl:697
_require_search_from_serialized at ./loading.jl:782
_require at ./loading.jl:1007
require at ./loading.jl:928
require at ./loading.jl:923
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2214 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2398
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1691 [inlined]
call_require at /buildworker/worker/package_linux64/build/src/toplevel.c:425 [inlined]
eval_import_path at /buildworker/worker/package_linux64/build/src/toplevel.c:462
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:682
jl_eval_module_expr at /buildworker/worker/package_linux64/build/src/toplevel.c:197
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:666
jl_parse_eval_all at /buildworker/worker/package_linux64/build/src/ast.c:913
jl_load_rewrite at /buildworker/worker/package_linux64/build/src/toplevel.c:914
include at ./Base.jl:380
include at ./Base.jl:368
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2214 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2398
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1691 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:117
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:206
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:157 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:566
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:660
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:840
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:790
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:790
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:883
jl_eval_string at /buildworker/worker/package_linux64/build/src/jlapi.c:114
juliacall_cmd at /tmp/RtmpL2rrSN/R.INSTALL214b254d3f9a4/JuliaCall/src/JuliaCall.cpp:54
_JuliaCall_juliacall_cmd at /tmp/RtmpL2rrSN/R.INSTALL214b254d3f9a4/JuliaCall/src/RcppExports.cpp:33
R_doDotCall at /home-user/xjwang/R/R-4.3.0/src/main/dotcode.c:868
do_dotcall at /home-user/xjwang/R/R-4.3.0/src/main/dotcode.c:1551
bcEval at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:7446
Rf_eval at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:1013
R_execClosure at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:2187
Rf_applyClosure at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:2113
bcEval at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:7414
Rf_eval at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:1013
R_execClosure at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:2187
Rf_applyClosure at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:2113
bcEval at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:7414
Rf_eval at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:1013
R_execClosure at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:2187
Rf_applyClosure at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:2113
Rf_eval at /home-user/xjwang/R/R-4.3.0/src/main/eval.c:1140
Rf_ReplIteration at /home-user/xjwang/R/R-4.3.0/src/main/main.c:262
R_ReplConsole at /home-user/xjwang/R/R-4.3.0/src/main/main.c:314
run_Rmainloop at /home-user/xjwang/R/R-4.3.0/src/main/main.c:1200
main at /home-user/xjwang/R/R-4.3.0/src/main/Rmain.c:29
__libc_start_main at /usr/lib64/libc.so.6 (unknown line)
_start at /usr/local/lib64/R/bin/exec/R (unknown line)
Allocations: 8904617 (Pool: 8900259; Big: 4358); GC: 7
Segmentation fault

and the problem still exists:

julia> using RCall
┌ Warning: RCall.jl: During startup - Warning messages:
│ 1: package "methods" in options("defaultPackages") was not found
│ 2: package ‘utils’ in options("defaultPackages") was not found
│ 3: package ‘grDevices’ in options("defaultPackages") was not found
│ 4: package ‘graphics’ in options("defaultPackages") was not found
│ 5: package ‘stats’ in options("defaultPackages") was not found
│ 6: package ‘methods’ in options("defaultPackages") was not found
└ @ RCall ~/.julia/packages/RCall/LWzAQ/src/io.jl:172

Many thanks for any suggestions.

huguesmp commented 4 months ago

I have the same problem on Linux Mint 21.3 (based on Ubuntu 22.04).

I installed R with Rig.

This is the output when loading RCall:

julia> using RCall
[ Info: Precompiling RCall [6f49c342-dc21-5d91-9882-a32aef131414]
┌ Warning: RCall.jl: Message d'avis :
│ package "methods" in options("defaultPackages") was not found 
│ Pendant le démarrage - Messages d'avis :
│ 1: package ‘utils’ in options("defaultPackages") was not found 
│ 2: package ‘grDevices’ in options("defaultPackages") was not found 
│ 3: package ‘graphics’ in options("defaultPackages") was not found 
│ 4: package ‘stats’ in options("defaultPackages") was not found 
│ 5: package ‘methods’ in options("defaultPackages") was not found 
└ @ RCall ~/.julia/packages/RCall/dDAVd/src/io.jl:172

julia> 

Any ideas?

huguesmp commented 4 months ago

Specifying R_HOME and LD_LIBRARY_PATH (as per these instructions) fixed this for me.

palday commented 4 months ago

@huguesmp Yes, for RCall this should be easy to fix by setting R_HOME.

@Xiaojun928 for JuliaCall ... it's a little bit harder because there's an extra layer of indirection. I can't really say more without knowing more about your setup, but I'm going to close this issue for now. If this is still a problem and you can provide more info (sessionInfo() in R and versioninfo() in Julia), then we can reopen the issue and see if there's a deeper problem.