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

"libR.so: cannot open shared object file: No such file or directory" and associated warnings after Pkg.build() #427

Closed
mkarikom opened this issue Jul 28, 2021 · 4 comments

Comments

@mkarikom
Copy link

mkarikom commented Jul 28, 2021

I have the following error, which complains about various libraries not being found.
However, a check shows that they exist:

Steps to reproduce:

Set up the environment:

julia> ENV["JULIA_PROJECT"]="/dfs6/pub/me/myproject" # make sure all workers can access the project enviroment
julia> ENV["R_HOME"]="/opt/apps/R/4.0.4/lib64/R" # make sure JuliaCall/RCall can access R
julia> ENV["R_LIBS"]="/opt/apps/R/4.0.4/lib64/R/library" # make sure that RCall.jl knows what packages are installed

Sanity check:

julia> ENV["R_HOME"]=<cluster R home> # "/opt/apps/R/4.0.4/lib64/R"
julia> readdir(ENV["R_HOME"]) # sanity check for R
  10-element Vector{String}:
   "COPYING"
   "SVN-REVISION"
   "bin"
   "doc"
   "etc"
   "include"
   "lib"
   "library"
   "modules"
   "share"
julia> [findall( x -> occursin(rc_lib, x), readdir(ENV["R_LIBS"])) for rc_lib in ["utils","grDevices","graphics","stats","methods"]] # sanity check for R libs
5-element Vector{Vector{Int64}}:
 [39, 320, 375, 403]
 [190]
 [191]
 [379, 380]
 [37, 253]

Build RCall:

julia> using Pkg
julia> Pkg.build("RCall")
    Building Conda → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/299304989a5e6473d985212c28928899c74e9421/build.log`
    Building RCall → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/5108a75602f6a11f7737707dff26461ef02abc66/build.log`

Attempt to use RCall:

julia> using Distributed,RCall
┌ Warning: RCall.jl: Error: package or namespace load failed for ‘methods’ in dyn.load(file, DLLpath = DLLpath, ...):
│  unable to load shared object '/opt/apps/R/4.0.4/lib64/R/library/methods/libs/methods.so':
│   libR.so: cannot open shared object file: No such file or directory
│ Warning message:
│ package "methods" in options("defaultPackages") was not found 
│ Error: package or namespace load failed for ‘utils’ in dyn.load(file, DLLpath = DLLpath, ...):
│  unable to load shared object '/opt/apps/R/4.0.4/lib64/R/library/utils/libs/utils.so':
│   libR.so: cannot open shared object file: No such file or directory
│ Error: package or namespace load failed for ‘grDevices’ in dyn.load(file, DLLpath = DLLpath, ...):
│  unable to load shared object '/opt/apps/R/4.0.4/lib64/R/library/grDevices/libs/grDevices.so':
│   libR.so: cannot open shared object file: No such file or directory
│ Error: package or namespace load failed for ‘graphics’ in dyn.load(file, DLLpath = DLLpath, ...):
│  unable to load shared object '/opt/apps/R/4.0.4/lib64/R/library/grDevices/libs/grDevices.so':
│   libR.so: cannot open shared object file: No such file or directory
│ Error: package or namespace load failed for ‘stats’ in dyn.load(file, DLLpath = DLLpath, ...):
│  unable to load shared object '/opt/apps/R/4.0.4/lib64/R/library/grDevices/libs/grDevices.so':
│   libR.so: cannot open shared object file: No such file or directory
│ Error: package or namespace load failed for ‘methods’ in dyn.load(file, DLLpath = DLLpath, ...):
│  unable to load shared object '/opt/apps/R/4.0.4/lib64/R/library/methods/libs/methods.so':
│   libR.so: cannot open shared object file: No such file or directory
│ During startup - Warning messages:
│ 1: package ‘utils’ in options("defaultPackages") was not found 
│ 2: package ‘grDevices’ in options("defaultPackages") was not found 
│ 3: package ‘graphics’ in options("defaultPackages") was not found 
│ 4: package ‘stats’ in options("defaultPackages") was not found 
│ 5: package ‘methods’ in options("defaultPackages") was not found 
└ @ RCall ~/.julia/packages/RCall/iMDW2/src/io.jl:160

Check that shared libs exist:

julia> isfile("/opt/apps/R/4.0.4/lib64/R/library/utils/libs/utils.so")
true

julia> isfile("/opt/apps/R/4.0.4/lib64/R/library/grDevices/libs/grDevices.so")
true

julia> isfile("/opt/apps/R/4.0.4/lib64/R/library/methods/libs/methods.so")
true

Note on warnings about missing R packages

Also the warnings like package <packagename> in options("defaultPackages") was not found are confusing because they were already verified under # sanity check for R libs above

@fcaira
Copy link

fcaira commented Jan 11, 2022

Hi @mkarikom, did you ever find a solution to this?

@mkarikom
Copy link
Author

Hi @mkarikom, did you ever find a solution to this?

The following is currently working, although some changes to the hpc environment (that I don't fully understand) may also have helped:

      library(JuliaCall)
      julia_setup(JULIA_HOME = Sys.getenv("JULIA_HOME"),verbose=TRUE,rebuild = TRUE,install=FALSE)

@ViralBShah
Copy link
Contributor

Please reopen if this is still an issue.

@AFFFPupu
Copy link

I had the same problem and solved by adding R into the PATH.

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

No branches or pull requests

4 participants