Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficulty installing RCall on a low version of julia #529

Open
isaamael opened this issue May 31, 2024 · 6 comments
Open

Difficulty installing RCall on a low version of julia #529

isaamael opened this issue May 31, 2024 · 6 comments

Comments

@isaamael
Copy link

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
Copy link
Collaborator

palday commented Jun 2, 2024

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"

@isaamael
Copy link
Author

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 !

@palday
Copy link
Collaborator

palday commented Jul 17, 2024

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"))

?

@isaamael
Copy link
Author

isaamael commented Jul 17, 2024

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?

@palday
Copy link
Collaborator

palday commented Jul 17, 2024

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"))

@isaamael
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants