Fail to precompile RCall package

R_HOME directory is all set and R installation is all good, but the precompiling step didn’t work.

julia> using RCall
[ Info: Precompiling RCall [6f49c342-dc21-5d91-9882-a32aef131414]
ERROR: LoadError: RCall not properly installed. Please run Pkg.build("RCall")
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] top-level scope at C:\Users\nicho\.julia\packages\RCall\eRsxl\src\RCall.jl:36
 [3] include(::Function, ::Module, ::String) at .\Base.jl:380
 [4] include(::Module, ::String) at .\Base.jl:368
 [5] top-level scope at none:2
 [6] eval at .\boot.jl:331 [inlined]
 [7] eval(::Expr) at .\client.jl:467
 [8] top-level scope at .\none:3
in expression starting at C:\Users\nicho\.julia\packages\RCall\eRsxl\src\RCall.jl:33
ERROR: Failed to precompile RCall [6f49c342-dc21-5d91-9882-a32aef131414] to C:\Users\nicho\.julia\compiled\v1.5\RCall\8GFyb_RACSn.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1305
 [3] _require(::Base.PkgId) at .\loading.jl:1030
 [4] require(::Base.PkgId) at .\loading.jl:928
 [5] require(::Module, ::Symbol) at .\loading.jl:923

Did you run Pkg.build("RCall") as the error suggests? What did it return?

Thank you for your help! I sorted it out finally. Just one follow-up question: Why do I need to run the “build” command? While installing other packages like DataFrames I just added it and it runs fine.

I don’t really know what happened in your case specifically, but generally the build command performs one-off set up steps, which only need to be completed upon installation.

It could be that something went wrong in the original installation, or something about your environment (e.g. the R version installed on your system) changed after installation, necessitating another build. This is most frequently the case for packages that rely on external dependencies (like RCall, IJulia, or GR) which they link during build stage.

Note that the build step happens automatically when first installing a package via add, so there generally shouldn’t be a need for a user to call build directly. It mainly becomes relevant if something breaks and re-running build becomes one thing to do to try and fix it.