It was working yesterday at night and today mornig started to show the errors above
After loading package (“using RCall”)
┌ Warning: RCall.jl: During startup - Warning message:
│ package ‘stats’ in options(“defaultPackages”) was not found
└ @ RCall C:\Users\danil.julia\packages\RCall\Wyd74\src\io.jl:172
After run some code:
REvalError: Error in inDL(x, as.logical(local), as.logical(now), …) :
unable to load shared object ‘C:/Users/danil/AppData/Local/Programs/R/R-4.2.2/library/stats/libs/x64/stats.dll’:
LoadLibrary failure: N�o foi poss�vel encontrar o m�dulo especificado.
Hi. Just wondering if you solved this? I’ve encountered the same problem despite ‘stats’ being visible as an installed package.
using Pkg
Pkg.add("RCall")
using RCall
┌ Warning: RCall.jl: During startup - Warning message:
│ package 'stats' in options("defaultPackages") was not found
└ @ RCall C:\Users\*****\.julia\packages\RCall\Wyd74\src\io.jl:172
R"""data.frame(installed.packages())[,1] |> is.element(el = "stats")"""
RObject{LglSxp}
[1] TRUE
I also can’t manually load the library; I see the same LoadLibrary failure you mentioned.
R"library(stats)"
ERROR: REvalError: Error: package or namespace load failed for 'stats' in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'C:/Program Files/R/R-4.2.2/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
Re-installing “stats” in R isn’t an option (for me) because it’s a base package (and shouldn’t be updated), loads by default (see options("defaultPackages") in R), and is installed; RCall just can’t see it or load it for some reason. (Plus, attempting to run R"""install.packages("stats")""" in Julia causes Julia to hang.)
I also have no troubles with the stats package when running R itself.
I’m running Julia v 1.8.5 on Windows; RCall v0.13.14 and R v 4.2.2. I see the error when running directly in the Julia REPL and via Jupyter lab.
I seem to have fixed it, though I don’t really understand how it worked.
Based on this discussion, I set my user-specific PATH Environment Variable to include both %R_HOME%\bin and %R_HOME%\bin\x64 (R_HOME was already set to the R installation root folder). RCall now loads without complaining about being unable to find the stats package.
I experienced exactly the same problem when updating R from 4.3.3 to 4.4.1. Julia was still looking for the “stats” package in the 4.3.3 folder, even after I manually deleted it from there. (The error in R was unhelpful, but when run in Julia said "package ‘stats’ does not have a namespace). RCall.RHome was pointing to the wrong directory, even after a rebuild. I had removed the R_HOME environmental variables, but putting them back in was enough to get Julia and R to talk to each other both directions again.