gher-uliege / EMODnet-Biology-PhaseV

Code and notes for the EMODnet Biology project
MIT License
0 stars 1 forks source link

Problem with shared object libraries #2

Open ctroupin opened 6 months ago

ctroupin commented 6 months ago

Summary

We experience issues due to different versions of the shared libraries. One setting allows one to work with DIVAnd, while other R libraries fail. The other setting allows the opposite.

How to reproduce?

Setting 1

Setting 2

Before starting the R session we set the environment variable:

export LD_PRELOAD=${HOME}/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/lib/julia/libcurl.so.4.8.0`

The previous commands should not work:

install.packages("JuliaCall")
library(JuliaCall)
julia_setup(JULIA_HOME = path.expand("~/.juliaup/bin/"))
julia_install_package_if_needed("DIVAnd")
julia_command("using DIVAnd")

Issue

Now we can try to load another library, for example ncdf4


> library("ncdf4")
Error: package or namespace load failed for ‘ncdf4’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/ctroupin/R/x86_64-pc-linux-gnu-library/4.3/ncdf4/libs/ncdf4.so':
  /home/ctroupin/.julia/juliaup/julia-1.10.1+0.x64.linux.gnu/lib/julia/libcurl.so.4.8.0: version `CURL_OPENSSL_4' not found (required by /usr/lib/x86_64-linux-gnu/libnetcdf.so.19)
``
maelle commented 6 months ago

just in case you don't know about callr, for when you want to call R in different sessions (from what I understood): https://callr.r-lib.org/

ctroupin commented 6 months ago

Thanks Maelle, I didn't know about the package, I will test that soon!

ctroupin commented 6 months ago

Testing under Windows by a colleague:

Installation of JuliaCall

> install.packages("JuliaCall")
Installing package into ‘C:/Users/Administrator/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/JuliaCall_0.17.5.zip'
Content type 'application/zip' length 1264289 bytes (1.2 MB)
downloaded 1.2 MB

package ‘JuliaCall’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\Administrator\AppData\Local\Temp\RtmpuSmFVL\downloaded_packages

Importing JuliaCall library

> library(JuliaCall)
Warning message:
package ‘JuliaCall’ was built under R version 4.2.3
> julia_setup(JULIA_HOME = path.expand("~/.juliaup/bin/"))
Error in julia_setup(JULIA_HOME = path.expand("~/.juliaup/bin/")) :
  Julia is not found.

Failure due to the Julia path not specified.

Importing JuliaCall after specifying Julia path

Seems to work without any issue.

> julia_setup(JULIA_HOME = "C:/Users/Administrator/.julia/juliaup/julia-1.10.1+0.x64.w64.mingw32/bin")
Julia version 1.10.1 at location C:\Users\ADMINI~1\JULIA~1\juliaup\JULIA-~1.MIN\bin will be used.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.
> julia_install_package_if_needed("DIVAnd")
NULL
> julia_install_package_if_needed("DIVAnd")
> julia_command("using DIVAnd")