I’m running a ResistanceGA package in R incorporating work in R and Julia. When I run the jl.prep function it gives me this error. Note it runs fine on my laptop, but when I try to run it in ComputeCanada (remote access computer) it gives me the error, which I’m assuming means that the access to julia works somehow differently :
Error: Error happens in Julia.
InitError: could not load library “/home/varv/.julia/artifacts/4e48910b6d6946bcb2a95632700ecc7e12ff8a9a/lib/libgdal.so”
/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/lib64/libtiff.so.6: version `LIBTIFF_4.6.1’ not found (required by /home/varv/.julia/artifacts/4e48910b6d6946bcb2a95632700ecc7e12ff8a9a/lib/libgdal.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/GfYNv/src/products/library_generators.jl:63 [inlined]
[4] init()
@ GDAL_jll ~/.julia/packages/GDAL_jll/YrNvh/src/wrappers/x86_64-linux-gnu-cxx11.jl:78
[5] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1115
[6] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
@ Base ./loading.
Execution halted
Julia exit.
The code specifically that I’m running is:
jl.inputs ← ResistanceGA::jl.prep( # jl.prep runs in Julia, allows for speed and parallel processing (well with large data, instead of CS.prep) ()
n.Pops = length(sampleBGLoc_NAD83), # n.Pops will be the no. of indiv in spPoints object (4728 bytes)
response = lower(PropSharBG2CM), # extracts the lower triangular part of your genetic distance matrix. Use pairwise genetic distance matrix (3432 bytes)
CS_Point.File = sampleBGLoc_NAD83, # spatial points dataframe - locations of the individuals
parallel = TRUE, # use several cores
cores = 8, # Check your systems core, adjust
JULIA_HOME = JULIA_HOME)# where the Julia binary files are stored
Most likely this means that R has already loaded libtiff, but has unfortunately loaded a different and incompatible (probably older) version of the library. So then libgdal.so cannot be loaded, because it requires the newer libtiff.
Usually a workaround is to use the LD_PRELOAD environment variable to force R to load a newer version of the library. (Probably there is a newer libtiff.so in /home/varv/.julia/artifacts/4e48910b6d6946bcb2a95632700ecc7e12ff8a9a/lib that you should use.)
I tried to do that:
LD_LIBRARY_PATH_COPY=“${LD_LIBRARY_PATH}”
export LD_LIBRARY_PATH=“”
and it still gives me the same error
For the versioninfo() I get this:
julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a (2023-08-24 14:43 UTC)
Build Info:
Note: This is an unofficial build, please report bugs to the project
responsible for this build and not to the Julia project unless you can
reproduce the issue using official builds available at Download Julia
This is rather unfortunate. It seems like R and Julia both need different versions of libtiff, and there may not be an easy way to resolve it.
Also, it is quite likely neither of the packages actually need libtiff (neither ResistanceGA nor Circuitscape), but there is no easy way to do anything about it.
The only thing I can recommend is use a clean R install with the minimum number of packages you need for ResistanceGA (removing all other packages and everything from the LD_LIBRARY_PATH), and hopefully you can avoid the conflict.
The problem with LD_PRELOAD, I think, is that I give the directory to the libtiff.so.6, which I could find a directory for. However, LIBTIFF_4.6.1 version just doesn’t exist. I was able to find LIBTIFF_4.7.0 or 4.6.0 only. Also, as I understand libtiff should be downloaded both for Julia and in my .bashrc and it’s a dependency package of GDAL, so I can either install GDAL and it will install libtiff as dependency, or separately install libtiff