# Julia can not find libtiff (R 4.4.0, Julia 1.9.3) when running ResistanceGA in R

**URL:** <https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [December 30, 2024, 9:06pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291 "2024-12-30T21:06:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![vladimirovav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vladimirovav/32/214453_2.png) [@vladimirovav](https://discourse.julialang.org/u/vladimirovav)\
**Post date:** [December 30, 2024, 9:06pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/1 "2024-12-30T21:06:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [December 30, 2024, 9:14pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/2 "2024-12-30T21:14:45Z")

</div>

> [@vladimirovav](#):
>
> 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

What’s the output of the Julia function `versioninfo()` on the machine where this doesn’t work? What happens if you do

```julia
LD_LIBRARY_PATH_COPY="${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH=""

```

before running your code?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 31, 2024, 3:12am UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/3 "2024-12-31T03:12:59Z")

</div>

> [@vladimirovav](#):
>
> 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/

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.)

---

<div class="post-metadata">

**Author:** ![vladimirovav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vladimirovav/32/214453_2.png) [@vladimirovav](https://discourse.julialang.org/u/vladimirovav)\
**Post date:** [December 31, 2024, 3:27pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/4 "2024-12-31T15:27:01Z")

</div>

Thank you for your advice.

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](https://julialang.org/downloads)

Platform Info:  
OS: Linux (x86\_64-pc-linux-gnu)  
CPU: 40 × Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz  
WORD\_SIZE: 64  
LIBM: libopenlibm  
LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512)  
Threads: 1 on 40 virtual cores  
Environment:  
JULIA\_DEPOT\_PATH = ::

---

<div class="post-metadata">

**Author:** ![vladimirovav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vladimirovav/32/214453_2.png) [@vladimirovav](https://discourse.julialang.org/u/vladimirovav)\
**Post date:** [December 31, 2024, 6:57pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/5 "2024-12-31T18:57:50Z")

</div>

> [@stevengj](#):
>
> `LD_PRELOAD`

Thank you for your advice.  
I tried to do this:  
export LD\_PRELOAD=/home/varv/.julia/artifacts/2efdb7b239e9f244a3a933925294ea27cc6a61c2/lib/libtiff.so.6

export LD\_LIBRARY\_PATH=/home/varv/.julia/artifacts/2efdb7b239e9f244a3a933925294ea27cc6a61c2/lib

and it still gives me the same error.

---

<div class="post-metadata">

**Author:** ![viralbshah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/viralbshah/32/54_2.png) [@viralbshah](https://discourse.julialang.org/u/viralbshah)\
**Post date:** [January 1, 2025, 8:02am UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/6 "2025-01-01T08:02:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 1, 2025, 3:44pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/7 "2025-01-01T15:44:51Z")

</div>

> [@viralbshah](#):
>
> 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.

I’m surprised that `LD_PRELOAD` does not fix it.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [January 1, 2025, 3:54pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/8 "2025-01-01T15:54:01Z")

</div>

That may not be sufficient if libtiff itself needs other libraries which aren’t found automatically in default search paths.

---

<div class="post-metadata">

**Author:** ![vladimirovav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vladimirovav/32/214453_2.png) [@vladimirovav](https://discourse.julialang.org/u/vladimirovav)\
**Post date:** [January 3, 2025, 7:19pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/9 "2025-01-03T19:19:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vladimirovav](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vladimirovav/32/214453_2.png) [@vladimirovav](https://discourse.julialang.org/u/vladimirovav)\
**Post date:** [January 13, 2025, 4:56pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/10 "2025-01-13T16:56:27Z")

</div>

So, to update you all on my problem (thank you everyone for your help), it looks like the problem is with computeCanada environment. The issue may arise from some kind of conflict with the way that the Julia environment is being called from R; there is a libtiff installation among the Julia binary artifacts, assuming this is the correct libtiff for the GDAL binary package that was installed for Circuitscape. So I am going with the option of using an Apptainer image ( a new thing I need to learn how to work with, and I’m already stuck lol).  
The idea here would be to start from a generic Ubuntu image (Linux environment), such as one would find on a PC, then to install R and Julia inside this image much as one would do in a PC, allowing me to run the R + Julia Circuitscape combination.

Other options were to move the code to either completely to R or to Julia, which can not work, since such code (or package) does not exist, and I’m not adept enough to create one from scratch

---

<div class="post-metadata">

**Author:** ![julian\_wittische](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/julian_wittische/32/220699_2.png) [@julian\_wittische](https://discourse.julialang.org/u/julian_wittische)\
**Post date:** [February 4, 2026, 2:41pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/11 "2026-02-04T14:41:46Z")

</div>

@vladimirovav  
Did you ever find a good solution? I have the exact same issue and I am desperate.

---

<div class="post-metadata">

**Author:** ![viralbshah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/viralbshah/32/54_2.png) [@viralbshah](https://discourse.julialang.org/u/viralbshah)\
**Post date:** [February 26, 2026, 1:54pm UTC](https://discourse.julialang.org/t/julia-can-not-find-libtiff-r-4-4-0-julia-1-9-3-when-running-resistancega-in-r/124291/12 "2026-02-26T13:54:36Z")

</div>

Perhaps the author of ResistanceGA can look into the library on how how it calls Circuitscape? I suspect it will help to run both of these in separate processes, so that R and Julia do not interfere with each other’s environments. Rather than using JuliaCall, perhaps a better approach may be to write a .ini file and just call circuitscape as an external command.

One possibility you could try is to see if you can overwrite the R libtiff with the Julia one or vice versa, and hopefully that doesn’t create other problems.
