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
Error happens when you try to execute command ENV["R_HOME"] #201
Comments
Please someone write a suggestion. |
I have encountered the same problem this week. I've tried downloading different versions of R (4.1, 4.2, 4.3.x) and different versions of Julia (1.9.1, 1.8.5, 1.5.7). I've gone through a number of github issue posts related to this but nothing has worked for me thus far. |
I have the same issuse |
kindly keep this post updated or write suggestion incase you get out of this issue. I download PowerShell 7 version. While the error is remain the same. |
I have the same problem (windows 11, R 4.2.3, julia 1.9.1). Julia is on path but I get the exact same error message. |
Less than a week ago, it was all working for me... R 4.2.3 (updated from 4.1.1) and Julia 1.9.0 (updated from 1.5.4). Even after the update, everything was working fine. However, when I fresh-installed R and Julia (and the necessary packages) on a freshly-formatted/rebuilt MacBook Pro/Ventura (the same one), I got the same errors/issues everyone else is talking about here (even after attempting various versions of R and Julia). I'm curious... for all the folks experiencing issues also... did things all of a sudden stopped working for you (meaning, it had been working)? Or is this your first attempt at making JuliaCall work? FYI... I reformat/rebuild my MacBook Pro ~every 6 months. No issues when I last did this ~6 months ago. |
In my case, it is my first attempt with julia and juliacall. |
It was my first attempt with Julia and JuliaCall, as well. |
For me sometimes I run into this problem, but when I restart my rsession, everything is fine. So I really don't know what is the cause of this. |
Hi All, Please follow the following procedure it resolve this issue for me. The PR #199 written by @JackDunnNZ should fix the problem. As a temporary measure, please try devtools::install_github("https://github.com/JackDunnNZ/JuliaCall/tree/patch-1") to install the specific version in that PR. The temporary version should be removed cleanly by calling remove.packages("JuliaCall"), and then calling install.packages("JuliaCall") to install the 'main' version when that PR is merged. |
The devtools worked for me! |
Using Ubuntu 23.04 with Julia 1.9.2 from the snap, this still fails for me after installing the patch. Details below. > JuliaCall::julia_eval("2+2")
Julia version 1.9.2 at location /snap/julia/83/bin will be used.
Loading setup script for JuliaCall...
ERROR: LoadError: Failed to precompile CategoricalArrays [324d7699-5711-5eae-9e2f-1d82baa6b597] to "/home/edd/.julia/compiled/v1.9/CategoricalArrays/jl_3HY749".
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:2300
[3] compilecache
@ ./loading.jl:2167 [inlined]
[4] _require(pkg::Base.PkgId, env::String)
@ Base ./loading.jl:1805
[5] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1660
[6] macro expansion
@ ./loading.jl:1648 [inlined]
[7] macro expansion
@ ./lock.jl:267 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1611
[9] include
@ ./Base.jl:457 [inlined]
[10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base ./loading.jl:2049
[11] top-level scope
@ stdin:3
in expression starting at /home/edd/.julia/packages/RCall/LWzAQ/src/RCall.jl:2
in expression starting at stdin:3
LoadError("/usr/local/lib/R/site-library/JuliaCall/julia/setup.jl", 16, ErrorException("Failed to precompile RCall [6f49c342-dc21-5d91-9882-a32aef131414] to \"/home/edd/.julia/compiled/v1.9/RCall/jl_VVDbM6\"."))
Error in .julia$cmd(paste0(Rhomeset, "Base.include(Main,\"", system.file("julia/setup.jl", :
Error happens when you try to execute command ENV["R_HOME"] = "/usr/lib/R";Base.include(Main,"/usr/local/lib/R/site-library/JuliaCall/julia/setup.jl") in Julia.
To have more helpful error messages,
you could considering running the command in Julia directly
In addition: Warning message:
In system2(file.path(.julia$bin_dir, "julia"), shQuote(command), :
running command ''/snap/julia/83/bin/julia' '--startup-file=no' '/usr/local/lib/R/site-library/JuliaCall/julia/install_dependency.jl' '/usr/lib/R' 2>&1' had status 139
> Sys.getenv("R_HOME")
[1] "/usr/lib/R"
> The > library(JuliaConnectoR)
> juliaEval("2+2")
Starting Julia ...
[1] 4
> |
Faraz I try your code: devtools::install_github("https://github.com/JackDunnNZ/JuliaCall/tree/patch-1") in the Console, but another error appears to me: Do you have the same Issue? Error: Error happens in Julia. |
Thank everyone for the feedback. The issue should be fixed by #199 , which is already merged into master. |
Following a fresh github install of > library(JuliaCall)
> julia_setup()
Julia version 1.9.2 at location /snap/julia/83/bin will be used.
Loading setup script for JuliaCall...
ERROR: LoadError: Failed to precompile CategoricalArrays [324d7699-5711-5eae-9e2f-1d82baa6b597] to "/home/edd/.julia/compiled/v1.9/CategoricalArrays/jl_ktNVkA".
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:2300
[3] compilecache
@ ./loading.jl:2167 [inlined]
[4] _require(pkg::Base.PkgId, env::String)
@ Base ./loading.jl:1805
[5] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1660
[6] macro expansion
@ ./loading.jl:1648 [inlined]
[7] macro expansion
@ ./lock.jl:267 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1611
[9] include
@ ./Base.jl:457 [inlined]
[10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
@ Base ./loading.jl:2049
[11] top-level scope
@ stdin:3
in expression starting at /home/edd/.julia/packages/RCall/LWzAQ/src/RCall.jl:2
in expression starting at stdin:3
LoadError("/usr/local/lib/R/site-library/JuliaCall/julia/setup.jl", 16, ErrorException("Failed to precompile RCall [6f49c342-dc21-5d91-9882-a32aef131414] to \"/home/edd/.julia/compiled/v1.9/RCall/jl_rUK5dV\"."))
Error in .julia$cmd(paste0(Rhomeset, "Base.include(Main,\"", system.file("julia/setup.jl", :
Error happens when you try to execute command ENV["R_HOME"] = "/usr/lib/R";Base.include(Main,"/usr/local/lib/R/site-library/JuliaCall/julia/setup.jl") in Julia.
To have more helpful error messages,
you could considering running the command in Julia directly
In addition: Warning message:
In system2(file.path(.julia$bin_dir, "julia"), shQuote(command), :
running command ''/snap/julia/83/bin/julia' '--startup-file=no' '/usr/local/lib/R/site-library/JuliaCall/julia/install_dependency.jl' '/usr/lib/R' 2>&1' had status 139
> No change for me it seems. |
@eddelbuettel It seems that the "installation" step for JuliaCall somehow fails and there is some error on the julia side. How about opening julia directly and run |
Good call. I may well have needed However, > library(JuliaCall)
> julia_setup()
Julia version 1.9.2 at location /snap/julia/83/bin will be used.
Loading setup script for JuliaCall...
Bus error (core dumped)
edd@rob:$ |
@eddelbuettel On the julia side, what is the result of |
Yeah I removed it earlier. It seems to work. (I only have one R in the path.) $ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.9.2 (2023-07-05)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using RCall # I have a call to fortunes::fortune() in my .Rprofile
I quit using SAS in 1991 because my productivity jumped at least 20% within one month of using S-Plus.
-- Frank Harrell
R-help (November 2003)
julia> |
@eddelbuettel
in julia? |
Looks promising: $ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.9.2 (2023-07-05)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using RCall
I recently attended a Ph.D. prelim exam where the candidate had proposed research on various ways of defining an R^2 statistic in the original data scale from a linear model fit to data in a
transformed scale determined by the Box-Cox method. There were seven different possible definitions for R^2, all of which, as acknowledged by the candidate and by the thesis advisor, were incorrect.
The purpose of this path-breaking study is to determine in some way which of these seven possible incorrect definitions should be used. My suggestion that the obvious answer was "none of them" was
regarded as somewhat heretical.
-- Douglas Bates
R-help (August 2000)
julia> R"library(JuliaCall)"
RObject{StrSxp}
[1] "JuliaCall" "stats" "graphics" "grDevices" "utils" "datasets" "methods" "base"
julia> R"julia_setup()"
Julia version 1.9.2 at location /snap/julia/83/bin will be used.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.
RObject{EnvSxp}
<environment: 0x4b59958>
julia> Should I try without my |
Not that is not it. I also get |
The fact that JuliaCall is okay in julia through RCall but is not okay from R means that the problem is really subtle. To simplify things a little bit, what is the result of running |
Still bad: edd@rob:~$ Rscript -e 'library(JuliaCall); julia_setup()'
Julia version 1.9.2 at location /snap/julia/83/bin will be used.
Loading setup script for JuliaCall...
Bus error (core dumped)
edd@rob:~$ |
These are the main steps in
What are the results of the code chunk? |
Weird. Pasting then one-by-one into a fresh session just ... works!. I really appreciate your patience. $ R
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
Just now I had an apparently insurmountable problem that's been bugging me for days, but phrasing my question in a form suitable for the R-help list enabled me to solve my own problem in two minutes
flat.
Thanks everyone.
-- Robin Hankin
R-help (March 2005)
> JULIA_HOME <- JuliaCall:::julia_locate()
> dll_command <- system.file("julia/libjulia.jl", package = "JuliaCall")
> dll_file <- system2(file.path(JULIA_HOME, "julia"), shQuote(dll_command), stdout = TRUE)
> try(dyn.load(dll_file))
> JuliaCall:::juliacall_initialize(dll_file, JULIA_HOME, "")
[1] TRUE
> Rhomeset <- paste0('ENV["R_HOME"] = "', R.home(), '";')
> JuliaCall:::juliacall_cmd(Rhomeset)
[1] TRUE
> message(1)
1
> JuliaCall:::juliacall_cmd("Base.load_julia_startup();")
[1] TRUE
> message(2)
2
> JuliaCall:::juliacall_cmd("using RCall")
[1] TRUE
> message(3)
3
> JuliaCall:::juliacall_cmd("unsafe_store!(cglobal((:R_CStackLimit,RCall.libR),Csize_t), typemax(Csize_t))")
[1] TRUE
> message(4)
4
>
> search()
[1] ".GlobalEnv" "package:stats" "package:graphics" "package:grDevices" "package:utils" "package:datasets" "package:methods" "Autoloads" "package:base"
> ls()
[1] "dll_command" "dll_file" "JULIA_HOME" "Rhomeset"
>
|
...Then I guess that the issue may be some other julia packages... Maybe we can try more code to see where the problem is from... Also thank you for your patience and the feedback.
|
It's "using Pkg" that does me in: > JULIA_HOME <- JuliaCall:::julia_locate()
> dll_command <- system.file("julia/libjulia.jl", package = "JuliaCall")
> dll_file <- system2(file.path(JULIA_HOME, "julia"), shQuote(dll_command), stdout = TRUE)
> try(dyn.load(dll_file))
> JuliaCall:::juliacall_initialize(dll_file, JULIA_HOME, "")
[1] TRUE
> Rhomeset <- paste0('ENV["R_HOME"] = "', R.home(), '";')
> JuliaCall:::juliacall_cmd(Rhomeset)
[1] TRUE
> JuliaCall:::juliacall_cmd("Base.load_julia_startup();")
[1] TRUE
> JuliaCall:::juliacall_cmd("using RCall")
[1] TRUE
> JuliaCall:::juliacall_cmd("unsafe_store!(cglobal((:R_CStackLimit,RCall.libR),Csize_t), typemax(Csize_t))")
[1] TRUE
> JuliaCall:::juliacall_cmd("Base.load_julia_startup()")
[1] TRUE
> JuliaCall:::juliacall_cmd("using Pkg")
Bus error (core dumped)
$ Any idea ? |
I get the same error even after installing the github version:
|
I am not able to run Julia in R 4.3 and Julia is 1.9. Julia on PATH but their synatxs are not running. The same error appear after runing syntax i.e. julia_setup(), JuliaCall::julia_command("a= 1+1"). Please find error in detail below
Julia version 1.9.1 at location C:\Users\PC\AppData\Local\Programs\JULIA-
1.1\bin will be used.1/R/R-43~1.1";Base.include(Main,"C:/Users/PC/AppData/Local/R/win-library/4.3/JuliaCall/julia/setup.jl") in Julia.Loading setup script for JuliaCall...
Error in .julia$cmd(paste0(Rhomeset, "Base.include(Main,"", system.file("julia/setup.jl", :
Error happens when you try to execute command ENV["R_HOME"] = "C:/PROGRA
To have more helpful error messages,
you could considering running the command in Julia directly
Plz suggest me a solution.
The text was updated successfully, but these errors were encountered: