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

Odd issue with JULIA_DEPOT_PATH makes ResistanceGA unusable #19281

Closed
GrahamDB opened this issue Nov 21, 2023 · 2 comments · Fixed by easybuilders/easybuild-easyblocks#3239 · May be fixed by #20106
Closed

Odd issue with JULIA_DEPOT_PATH makes ResistanceGA unusable #19281

GrahamDB opened this issue Nov 21, 2023 · 2 comments · Fixed by easybuilders/easybuild-easyblocks#3239 · May be fixed by #20106
Milestone

Comments

@GrahamDB
Copy link

I have been trying to track down this issue for a few hours now and I am fairly certain it due to an interaction issue caused by ResistanceGA/4.2-5-foss-2022a-R-4.2.1-Julia-1.9.2 loading both Circuitscape/5.12.3-Julia-1.9.2 and RCall/0.13.17-foss-2022a-R-4.2.1-Julia-1.9.2 .

Basic error:
[XXX@host ~]$ module purge
[XXX@host ~]$ module load ResistanceGA
[XXX@host ~]$ R --no-save

R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 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.

library(ResistanceGA)
Loading required package: raster
Loading required package: sp
julia_setup()
Julia version 1.9.2 at location /apps/current/software/Julia/1.9.2-linux-x86_64/bin will be used.
Loading setup script for JuliaCall...
LoadError("/apps/current/software/ResistanceGA/4.2-5-foss-2022a-R-4.2.1-Julia-1.9.2/JuliaCall/julia/setup.jl", 16, ArgumentError("Package RCall not found in current path.\n- Run import Pkg; Pkg.add(\"RCall\") to install the RCall package.")) 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"] = "/apps/current/software/R/4.2.1-foss-2022a/lib64/R";Base.include(Main,"/apps/current/software/ResistanceGA/4.2-5-foss-2022a-R-4.2.1-Julia-1.9.2/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 ''/apps/current/software/Julia/1.9.2-linux-x86_64/bin/julia' '--startup-file=no' '/apps/current/software/ResistanceGA/4.2-5-foss-2022a-R-4.2.1-Julia-1.9.2/JuliaCall/julia/install_dependency.jl' '/apps/current/software/R/4.2.1-foss-2022a/lib64/R' 2>&1' had status 1

So it is not finding RCall.
Looking into it further:

[XXX@host ~]$ module purge
[XXX@host ~]$ module load ResistanceGA
[XXX@host ~]$ 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> Base.DEPOT_PATH
5-element Vector{String}:
"/home/asterion/.julia"
"/apps/current/software/Julia/1.9.2-linux-x86_64/local/share/julia"
"/apps/current/software/Julia/1.9.2-linux-x86_64/share/julia"
"/apps/current/software/Circuitscape/5.12.3-Julia-1.9.2"
"/apps/current/software/RCall/0.13.17-foss-2022a-R-4.2.1-Julia-1.9.2"
julia> Base.load_path()
2-element Vector{String}:
"/apps/current/software/Circuits" ⋯ 23 bytes ⋯ "/environments/v1.9/Project.toml"
"/apps/current/software/Julia/1.9.2-linux-x86_64/share/julia/stdlib/v1.9"

julia> using RCall
│ Package RCall not found, but a package named RCall is available from a registry.
│ Install package?
│ (@v1.9) pkg> add RCall
└ (y/n/o) [y]: n
julia> exit()
[XXX@host ~]$ module purge
[XXX@host ~]$ module load RCall
[XXX@host ~]$ 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

julia> exit()
[XXX@host ~]$ module purge
[XXX@host ~]$ module load ResistanceGA
[XXX@host ~]$ export JULIA_LOAD_PATH=":/apps/current/software/Circuitscape/5.12.3-Julia-1.9.2/environments/v1.9/Project.toml:/apps/current/software/RCall/0.13.17-foss-2022a-R-4.2.1-Julia-1.9.2/environments/v1.9/Project.toml"
[XXX@host ~]$ 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> Base.LOAD_PATH
5-element Vector{String}:
"@"
"@v#.#"
"@StdLib"
"/apps/current/software/Circuits" ⋯ 23 bytes ⋯ "/environments/v1.9/Project.toml"
"/apps/current/software/RCall/0." ⋯ 36 bytes ⋯ "/environments/v1.9/Project.toml"

julia> Base.load_path()
3-element Vector{String}:
"/apps/current/software/Circuits" ⋯ 23 bytes ⋯ "/environments/v1.9/Project.toml"
"/apps/current/software/Julia/1.9.2-linux-x86_64/share/julia/stdlib/v1.9"
"/apps/current/software/RCall/0." ⋯ 36 bytes ⋯ "/environments/v1.9/Project.toml"

julia> using MacroTools

julia> using RCall
[ Info: Precompiling RCall [6f49c342-dc21-5d91-9882-a32aef131414]
WARNING: could not import DataAPI.rownumber into DataFrames
┌ Warning: Module StatsFunsInverseFunctionsExt with build ID ffffffff-ffff-ffff-0036-7cb1f0ab53d3 is missing from the cache.
│ This may mean StatsFunsInverseFunctionsExt [da3fed98-1718-55bb-8128-3e4a2e454b06] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:1793
┌ Error: Error during loading of extension StatsFunsInverseFunctionsExt of StatsFuns, use Base.retry_load_extensions() to retry.
│ exception =
│ 1-element ExceptionStack:
│ Declaring precompile(false) is not allowed in files that are being precompiled.
│ Stacktrace:
│ [1] _require(pkg::Base.PkgId, env::Nothing)
│ @ Base ./loading.jl:1797
│ [2] _require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│ @ Base ./loading.jl:1660
│ [3] _require_prelocked(uuidkey::Base.PkgId)
│ @ Base ./loading.jl:1658
│ [4] run_extension_callbacks(extid::Base.ExtensionId)
│ @ Base ./loading.jl:1255
│ [5] run_extension_callbacks(pkgid::Base.PkgId)
│ @ Base ./loading.jl:1290
│ [6] run_package_callbacks(modkey::Base.PkgId)
│ @ Base ./loading.jl:1124
│ [7] _require_prelocked(uuidkey::Base.PkgId, env::String)
│ @ Base ./loading.jl:1667
│ [8] macro expansion
│ @ ./loading.jl:1648 [inlined]
│ [9] macro expansion
│ @ ./lock.jl:267 [inlined]
│ [10] require(into::Module, mod::Symbol)
│ @ Base ./loading.jl:1611
│ [11] include
│ @ ./Base.jl:457 [inlined]
│ [12] 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
│ [13] top-level scope
│ @ stdin:3
│ [14] eval
│ @ ./boot.jl:370 [inlined]
│ [15] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
│ @ Base ./loading.jl:1903
│ [16] include_string
│ @ ./loading.jl:1913 [inlined]
│ [17] exec_options(opts::Base.JLOptions)
│ @ Base ./client.jl:305
│ [18] _start()
│ @ Base ./client.jl:522
└ @ Base loading.jl:1261

julia> exit()

So overriding JULIA_LOAD_PATH doesn't solve the problem.
The only solution that comes to mind is to have the ResistanceGA easyconfig build a new package depot containing the all of the modules for RCall and Circuitscape, but that seems problematic.

@boegel boegel added this to the 4.x milestone Nov 22, 2023
@boegel
Copy link
Member

boegel commented Nov 22, 2023

@lexming Any feedback on this?

@lexming
Copy link
Contributor

lexming commented Mar 13, 2024

The issue here is multiple:

  1. on one hand if the user has an active shared environment for julia in its home directory, that might render the packages in the modules unfindable if they are not properly set in the LOAD_PATH of julia
  2. load order between RCall and Circuitscape matters, RCall (which is the bridge between Julia and R) seems to be special and needs to be first in the LOAD_PATH
  3. load order between R and Julia matters, as discussed in issue Segmentation fault when trying to test ResistanceGA #17692

The changes in #20106 solve these issues.

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