RCall.jl icon indicating copy to clipboard operation
RCall.jl copied to clipboard

Failed to precompile RCall on Julia v1.8

Open fabrizioleone opened this issue 2 years ago • 1 comments

Hi,

I have recently updated Julia from v1.7 to v1.8. I can correctly install RCall. However, when I type using RCall in the REPL, I get the following error message:

Failed to precompile RCall [6f49c342-dc21-5d91-9882-a32aef131414] to /Users/fabrizio/.julia/compiled/v1.8/RCall/jl_Epnq88.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:1705
  [3] compilecache
    @ ./loading.jl:1649 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [6] macro expansion
    @ ./loading.jl:1180 [inlined]
  [7] macro expansion
    @ ./lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
  [9] eval
    @ ./boot.jl:368 [inlined]
 [10] eval
    @ ./Base.jl:65 [inlined]
 [11] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.7.10/scripts/packages/VSCodeServer/src/repl.jl:222
 [12] (::VSCodeServer.var"#107#109"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.7.10/scripts/packages/VSCodeServer/src/repl.jl:186
 [13] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:511
 [14] with_logger
    @ ./logging.jl:623 [inlined]
 [15] (::VSCodeServer.var"#106#108"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.7.10/scripts/packages/VSCodeServer/src/repl.jl:187
 [16] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
 [17] invokelatest(::Any)
    @ Base ./essentials.jl:726
 [18] macro expansion
    @ ~/.vscode/extensions/julialang.language-julia-1.7.10/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
 [19] (::VSCodeServer.var"#61#62")()
    @ VSCodeServer ./task.jl:484

Any lead about how to get around it is very much appreciated. Thank you.

fabrizioleone avatar Sep 13 '22 12:09 fabrizioleone

I've also encountered this. If I try Pkg.build(RCall), the build hangs:

julia> Pkg.build("RCall")
    Building Conda → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/6e47d11ea2776bc5627421d59cdcc1296c058071/build.log`
    Building RCall → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/72fddd643785ec1f36581cbc3d288529b96e99a7/build.log`
  Progress [====================>                    ]  1/2

ablaom avatar Sep 16 '22 01:09 ablaom

What OS is this on? This worked fine for me.

ViralBShah avatar Oct 18 '22 23:10 ViralBShah

For me its macOS:

julia> versioninfo()
Julia Version 1.8.2
Commit 36034abf260 (2022-09-29 15:21 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin21.4.0)
  CPU: 12 × Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 5 on 12 virtual cores
Environment:
  JULIA_LTS_PATH = /Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
  JULIA_PATH = /Applications/Julia-1.8.app/Contents/Resources/julia/bin/julia
  JULIA_EGLOT_PATH = /Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
  JULIA_NUM_THREADS = 5
  DYLD_LIBRARY_PATH = /usr/local/homebrew/Cellar/libomp/9.0.1/lib/
  JULIA_NIGHTLY_PATH = /Applications/Julia-1.8.app/Contents/Resources/julia/bin/julia

ablaom avatar Oct 18 '22 23:10 ablaom

I tested on macOS 1.8 as well. I installed R from homebrew.

ViralBShah avatar Oct 18 '22 23:10 ViralBShah

Mmm. Sometime, long ago, when I first installed Call I seemed to have set R_HOME set to "*" in my .bashrc, which according to RCall docs should trigger a julia-local Conda install, right? I'm not a regular RCall user but believe this used to work. Curiously, if I do echo $R_HOME now, I don't get "*", I get what looks like a directory listing, like * is interpreted as wild-card:

(py37) humus:~ anthony$ echo $R_HOME
17.pdf Applications Desktop Documents Downloads Dropbox FlowMeter.xlsx Google Drive GoogleDrive HelloJulia Julia Library MLJ MLJTutorial Movies Music OneDrive Path Pictures Public Sites TableTransforms Untitled.ipynb Untitled1.ipynb Untitled2.ipynb Untitled3.ipynb Untitled4.ipynb Untitled5.ipynb Untitled6.ipynb Untitled7.ipynb anaconda2 contents contents1 junk junk.jls junk.jl~ junk.txt junk_big.jlso junk_depot junk_small.jlso kale_rsa.pub myemacs new_names notebook.unexecuted.ipynb pbcopy personal_access_token personal_access_token2 personal_access_token2~ quark_cake.jpeg sandbox scikit_learn_data temp temp.jl tmp usr waste_of_time.md

Could this be the issue? In that case how do I set my R_HOME to have RCall.jl handle the R installation?

ablaom avatar Oct 19 '22 00:10 ablaom

I'm also not a regular R or RCall user - but I just noted that RCall found my homebrew installed R and I didn't have to set R_HOME or anything. It was pleasantly straightforward.

ViralBShah avatar Oct 19 '22 00:10 ViralBShah

For the record, I've just tried today without changing R_HOME and Pkg.build(Call) worked (with no change to my weird R_HOME). I have not idea what changed. R was installed using Conda in .julia

ablaom avatar Oct 20 '22 22:10 ablaom

I will note that it just hangs for a long time and then continues. In general, we should probably not try to do this automatically, and just document the instructions for people wanting to install R from conda, or provide their own R. It's unnecessarily magical right now. No real R user would wants to call R would want their R to be installed by Conda in .julia!

ViralBShah avatar Oct 21 '22 00:10 ViralBShah