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

Using NCDatasets.jl in R #210

Closed
ctroupin opened this issue Jun 19, 2023 · 2 comments
Closed

Using NCDatasets.jl in R #210

ctroupin opened this issue Jun 19, 2023 · 2 comments

Comments

@ctroupin
Copy link
Collaborator

ctroupin commented Jun 19, 2023

Not sure if I'd better submit the issue here or somewhere in R repos...

Describe the bug

I run Julia from R and then try to import NCDatasets. Three consecutive executions of the command using NCDatasets provide three different outputs:

julia> using NCDatasets
ERROR: InitError: could not load library "/home/ctroupin/.julia/artifacts/461703969206dd426cc6b4d99f69f6ffab2a9779/lib/libnetcdf.so"
/usr/lib/x86_64-linux-gnu/libcurl.so: version `CURL_4' not found (required by /home/ctroupin/.julia/artifacts/461703969206dd426cc6b4d99f69f6ffab2a9779/lib/libnetcdf.so)
during initialization of module NetCDF_jll

julia> using NCDatasets
ERROR: InitError: could not load symbol "nc_inq_libvers":
/home/ctroupin/.julia/juliaup/julia-1.8.5+0.x64.linux.gnu/bin/julia: undefined symbol: nc_inq_libvers
during initialization of module NCDatasets

julia> using NCDatasets

(yes, the 3rd execution doesn't give any message).

I've seen that the libcurl.so: version CURL_4 error is mentioned in the Known issues so I tried to call Julia with both LD_LIBRARY_PATH and LD_PRELOAD set as empty.

To Reproduce

Within a R session, call Julia and then import NCDatasets

system("julia")
julia> using NCDatasets

Tested with:

  • julia-1.9.1+0.x64.linux.gnu
  • julia-1.8.5+0.x64.linux.gnu

Expected behavior

A working NCDatasets within R.

Environment

  • operating system: Ubuntu 22.04.2 LTS
  • Julia version: julia-1.9.1+0.x64.linux.gnu (official binary)
  • Output of the julia command versioninfo()
julia> versioninfo()
Julia Version 1.9.1
Commit 147bdf428cd (2023-06-07 08:27 UTC)
Platform Info:
 OS: Linux (x86_64-linux-gnu)
 CPU: 16 × AMD Ryzen 7 3800X 8-Core Processor
 WORD_SIZE: 64
 LIBM: libopenlibm
 LLVM: libLLVM-14.0.6 (ORCJIT, znver2)
 Threads: 1 on 16 virtual cores
Environment:
 LD_LIBRARY_PATH = /usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server
``
- NCDatasets version: ` [85f8d34a] NCDatasets v0.12.17
- Output of `using Pkg; Pkg.status(mode=PKGMODE_MANIFEST)`

**Full output**

In case of an error, please paste the full error message and stack trace.
@Alexander-Barth
Copy link
Owner

Maybe on can experiment with setting LD_PRELOAD (https://stackoverflow.com/questions/426230/what-is-the-ld-preload-trick ) or LD_LIBRARY_PATH?
But the root issue is that R and julia are compiled with an incompatible curl library.
Maybe the users/developers of RCall know more?

@ctroupin
Copy link
Collaborator Author

ok thanks, so using LD_PRELOAD with the libcurl version used by Julia seems to solve the issue

export LD_PRELOAD=/home/ctroupin/.local/share/R/JuliaCall/julia/1.9.1/julia-1.9.1/lib/julia/libcurl.so.4.8.0

(then starting a R session, launching Julia, and importing NCDatasets).

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

2 participants