Circuitscape / Circuitscape.jl

Algorithms from circuit theory to predict connectivity in heterogeneous landscapes
https://circuitscape.org
MIT License
128 stars 35 forks source link

Loading Circuitscape in R (via Julia) #381

Closed nataliemyers12 closed 1 month ago

nataliemyers12 commented 1 year ago

Hi,

I am trying to use Circuitscape to optimize resistance layers in R, via julia. I have successfully install Circuitscape to Julia, and successfully loaded it there. I have also successfully called JuliaCall, and am able to use julia to perform other functions inside R.

I have 2 errors occuring. When I am in julia, and test Circuitscape, I get this warning, although it passes all of the tests:

WARNING: could not import Circuitscape.compute_mklpardiso into Main.

Then, when I try to call and test circuitscape within Julia in R, I get this error: jl.inputs<- jl.prep(n.Pops=NROW(plhon),CS_Point.File=plhonsp,response=lower(as.matrix(gen.dist)),cholmod = TRUE, JULIA_HOME=JULIA_HOME) Error: Error happens in Julia. InitError: could not load library "/home/thomsonlab/.julia/artifacts/2d4a566ad73ee204aaae3ef08cfc954f2674e5f1/lib/libnetcdf.so" /lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_4' not found (required by /home/thomsonlab/.julia/artifacts/2d4a566ad73ee204aaae3ef08cfc954f2674e5f1/lib/libnetcdf.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() @ NetCDF_jll ~/.julia/packages/NetCDF_jll/VOWKB/src/wrappers/x86_64-linux-gnu.jl:12 [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] _requiresearch

I believe this is an issue with Circuitscape integrating with Julia because I can use Julia within R to do other functions, just not use Circuitscape. I would love any advice.

R info: R version 4.3.0 (2023-04-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.2 LTS

Matrix products: default BLAS: /usr/local/lib/R/lib/libRblas.so LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3; LAPACK version 3.10.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Pacific/Honolulu tzcode source: system (glibc)

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] compiler_4.3.0

Julia info:

Julia Version 1.8.5 Commit 17cfb8e65ea (2023-01-08 06:45 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 40 × Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, ivybridge) Threads: 1 on 40 virtual cores Environment: LD_LIBRARY_PATH = /usr/local

ViralBShah commented 1 year ago

Can you run the Circuitscape testsuite standalone in Julia first without calling from R? And install the latest versions of everything?

wenzmo commented 2 months ago

I this still in issue? I could manage to run circuitscape totally from R without installing Julia before....

install.packages("JuliaCall") library(JuliaCall) julia_setup(installJulia = TRUE) # here you just install Julia within the JuliaCall package julia_install_package_if_needed("Circuitscape") # maybe you can skip this line julia_library("Circuitscape") julia_call("compute", "ourpath/ini_file.ini")

ViralBShah commented 1 month ago

Please reopen if still an issue, but it may actually be an issue elsewhere and not this package.