Problems with starting circuitscape from R package JuliaCall

Hi, I’m brandnew to julia and I am facing a hard time while trying to run my analysis.

The situation is that I’m trying to run the package Circuitscape using JuliaCall within R in a custom docker container and I kept getting the same error. Circuitscape works just fine outside R environment when I open julia from linux terminal and I don’t have much clue of what is going on nor how to fix it.

root@704676239b3d:/# R

> system("julia")
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.5 (2023-01-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Circuitscape
ERROR: InitError: could not load library "/root/.julia/artifacts/8a643038d2adde781829b4467a32afa307e23b51/lib/libproj.so"
/usr/lib/x86_64-linux-gnu/libcurl.so: version `CURL_4' not found (required by /root/.julia/artifacts/8a643038d2adde781829b4467a32afa307e23b51/lib/libproj.so)
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:116
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
  [4] __init__()
    @ PROJ_jll ~/.julia/packages/PROJ_jll/oT9sV/src/wrappers/x86_64-linux-gnu-cxx11.jl:60
  [5] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base ./loading.jl:831
  [6] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, sourcepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:938
  [7] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
    @ Base ./loading.jl:1028
  [8] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1315
  [9] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
 [10] macro expansion
    @ ./loading.jl:1180 [inlined]
 [11] macro expansion
    @ ./lock.jl:223 [inlined]
 [12] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
during initialization of module PROJ_jll

Oh, this may be me being misled but on this line:

/usr/lib/x86_64-linux-gnu/libcurl.so: version `CURL_4’ not found (required by /root/.julia/artifacts/8a643038d2adde781829b4467a32afa307e23b51/lib/libproj.so)

Curl is not detected in your container. Do you have curl installed in your system? Should be a quick sudo apt-get install curl or sudo dnf install curl within your container. Then, I’d suggest restarting R and Julia and seeing if that error goes away.

~ tcp :deciduous_tree:

P.S. Welcome to the Julia community! :wave:

Well, curl is already installed as a dependency for some R packages locally, I’m finding that it might be a library path conflict because when I run before starting R:

root@704676239b3d:/# export R_LD_LIBRARY_PATH=/home/julia-1.8.5/lib/julia:/usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/
lib/jvm/default-java/lib/server::/root/.julia/artifacts/8a643038d2adde781829b4467a32afa307e23b51/lib

and try to do the same steps as I mentioned before the code works just fine with julia.

root@704676239b3d:/# R

> system("julia")
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.5 (2023-01-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Circuitscape

julia>

Although the application that I’m mainly running is implemented in R, and when I need to load it’s library I face the following:

> library(ResistanceGA)
Loading required package: raster
Loading required package: sp
Error: package or namespace load failed for 'raster' in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/site-library/terra/libs/terra.so':
  /home/julia-1.8.5/lib/julia/libcurl.so.4: version `CURL_OPENSSL_4' not found (required by /lib/libgdal.so.30)
Error: package 'raster' could not be loaded

So I kind of get the same error because now it is other version of libcurl.
Would you have any insight on what should I do to solve this one?
Something that I’d like to add is that when I start R and load this library without changing the R_LD_LIBRARY_PATH it works just fine.
And thank you for the quick response and welcoming in the community!! =D

Strange! I did some looking at the RCall.jl open GitHub Issues and found this discussion which seems very similar to the problem you are running into: conflict libcurl.so in Julia 1.8 · Issue #475 · JuliaInterop/RCall.jl · GitHub

CC @giordano as that conversation involved him as well.

1 Like