JuliaInterop / RCall.jl

Call R from Julia
Other
318 stars 59 forks source link

Difficulty installing RCall on a low version of julia #529

Open isaamael opened 1 month ago

isaamael commented 1 month ago

Hi ! I had to install RCall in Julia 1.4.0 because of the R package dependency, I ran the following code, however I'm having trouble resolving the error

julia> ENV["R_HOME"] = "~/miniconda3/envs/RTIGER/lib/R"
"~/miniconda3/envs/RTIGER/lib/R"

julia> Rhome = "~/miniconda3/envs/RTIGER/lib/R"
"~/miniconda3/envs/RTIGER/lib/R"

julia> libR = "~/miniconda3/envs/RTIGER/lib/R/lib/libR.so"
"~/miniconda3/envs/RTIGER/lib/R/lib/libR.so"

julia> Pkg.build(PackageSpec(name="RCall", version="0.13.2"))
   Building Conda → `~/.julia/packages/Conda/sDjAP/deps/build.log`
   Building RCall → `~/.julia/packages/RCall/ffM0W/deps/build.log`
┌ Error: Error building `RCall`: 
│ ERROR: LoadError: R_HOME is not a directory.
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] top-level scope at /public/home/xuruiqiang/.julia/packages/RCall/ffM0W/deps/build.jl:42
│  [3] include(::String) at ./client.jl:439
│  [4] top-level scope at none:5
│ in expression starting at /public/home/xuruiqiang/.julia/packages/RCall/ffM0W/deps/build.jl:10
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:892

R is installed via conda and I have determined that "~/miniconda3/envs/RTIGER/lib/R" is the folder. I specified the RCall version, because the newer versions of RCall don't work on Julia before 1.6.0+, I don't know if 0.13.2 will, I didn't find instructions corresponding to the julia version! I'd like to try it, but the installation comes first!

Seeking help !

palday commented 1 month ago

Instead of using the ~, can you use the full path? ~ is something that Bash provides and it's not necessarily recognized at the file system level. Looking at the rest of your error message, you need something like

julia> ENV["R_HOME"] = "/public/home/xuruiqiang/miniconda3/envs/RTIGER/lib/R"