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

Difficulty installing RCall on a low version of julia

Open isaamael opened this issue 1 year ago • 6 comments

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 !

isaamael avatar May 31 '24 11:05 isaamael

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"

palday avatar Jun 02 '24 16:06 palday

Dear Developer, @palday Firstly, I apologize for the late reply, I’ve been tied up with too many trivial matters! I tried the method you suggested, however, the same error still appears.

[xuruiqiang@login2 ~]$ source ~/miniconda3/bin/activate RTIGER
(RTIGER) [xuruiqiang@login2 ~]$ R RHOME
/public/home/xuruiqiang/miniconda3/envs/RTIGER/lib/R
(RTIGER) [xuruiqiang@login2 ~]$ which R
~/miniconda3/envs/RTIGER/bin/R
(RTIGER) [xuruiqiang@login2 ~]$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.0 (2020-03-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

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

julia> ENV["JULIA_R_HOME"] = "/public/home/xuruiqiang/miniconda3/envs/RTIGER/bin/R"
"/public/home/xuruiqiang/miniconda3/envs/RTIGER/bin/R"

julia> using Pkg

julia> Pkg.build(PackageSpec(name="RCall", version="0.13.6"))
   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 cannot be found. Set the "R_HOME" environment variable to re-run Pkg.build("RCall").
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] top-level scope at /public/home/xuruiqiang/.julia/packages/RCall/ffM0W/deps/build.jl:47
│  [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

In addition, I also tried several other methods, all to no avail. As you can see, R is in the conda environment, and Julia is in the system environment variables. I need to install RCall in Julia in order to use a specific R package. I don’t know if you can provide any other suggestions to help identify where the problem lies and how to solve it. Please forgive me as a programming novice and Julia newbie. Any advice is needed !

isaamael avatar Jul 16 '24 02:07 isaamael

What happens if you do

ENV["R_HOME"] = "/public/home/xuruiqiang/miniconda3/envs/RTIGER/bin/R"
using Pkg
Pkg.build(PackageSpec(name="RCall", version="0.13.6"))

?

palday avatar Jul 17 '24 12:07 palday

emmm......it dose not work

julia> ENV["R_HOME"] = "/public/home/xuruiqiang/miniconda3/envs/RTIGER/bin/R"
"/public/home/xuruiqiang/miniconda3/envs/RTIGER/bin/R"
julia> using Pkg
julia> Pkg.build(PackageSpec(name="RCall", version="0.13.6"))
   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

Any chance it's a problem with the julia install?

isaamael avatar Jul 17 '24 14:07 isaamael

One more idea:

(RTIGER) [xuruiqiang@login2 ~]$ LD_LIBRARY_PATH="/public/home/xuruiqiang/miniconda3/envs/RTIGER/lib/R/lib/:$LD_LIBRARY_PATH" julia
julia> ENV["R_HOME"] = "/public/home/xuruiqiang/miniconda3/envs/RTIGER/lib/R"
julia> using Pkg
julia> Pkg.build(PackageSpec(name="RCall", version="0.13.6"))

palday avatar Jul 17 '24 14:07 palday

still erro.


(RTIGER) [xuruiqiang@login2 julia-1.4.0]$ LD_LIBRARY_PATH="/public/home/xuruiqiang/miniconda3/envs/RTIGER/lib/R/lib/:$LD_LIBRARY_PATH" julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.0 (2020-03-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

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

julia> using Pkg

julia> Pkg.build(PackageSpec(name="RCall", version="0.13.6"))
   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 cannot be found. Set the "R_HOME" environment variable to re-run Pkg.build("RCall").
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] top-level scope at /public/home/xuruiqiang/.julia/packages/RCall/ffM0W/deps/build.jl:47
│  [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

isaamael avatar Jul 17 '24 15:07 isaamael