Circuitscape / Circuitscape.jl

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

Error when using Circuitscape from R #262

Closed jessjaco closed 4 years ago

jessjaco commented 4 years ago

I am trying to run Circuitscape from inside R.

This works as expected (from a command prompt):

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

julia> using Circuitscape

This gives an error

$ R
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> system("julia")

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

julia> using Circuitscape
ERROR: InitError: could not load library "/home/me/.julia/artifacts/519367e9365948074c1fcc9f4365597f147a5ab7/lib/libmbedtls.so"
/usr/lib/x86_64-linux-gnu/libmbedx509.so.0: undefined symbol: mbedtls_mutex_unlock
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
 [2] dlopen(::String, ::UInt32) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
 [3] __init__() at /home/csp/.julia/packages/MbedTLS_jll/qGMUr/src/wrappers/x86_64-linux-gnu.jl:74
 [4] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [5] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:782
 [6] _tryrequire_from_serialized(::Base.PkgId, ::UInt64, ::String) at ./loading.jl:712
 [7] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:771
 [8] _tryrequire_from_serialized(::Base.PkgId, ::UInt64, ::String) at ./loading.jl:712
 [9] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:771
 [10] _tryrequire_from_serialized(::Base.PkgId, ::UInt64, ::String) at ./loading.jl:712
 [11] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:771
 [12] _tryrequire_from_serialized(::Base.PkgId, ::UInt64, ::String) at ./loading.jl:712
 [13] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:771
 [14] _require(::Base.PkgId) at ./loading.jl:1007
 [15] require(::Base.PkgId) at ./loading.jl:928
 [16] require(::Module, ::Symbol) at ./loading.jl:923
during initialization of module MbedTLS_jll

Using the JuliaCall package to call julia gives the same error

jessjaco commented 4 years ago

Appears to be some sort of packaging issue ??? (sorry I don't know julia) as this works (from R): system("julia -e 'import Pkg; Pkg.add(\"MbedTLS_jll\");using Circuitscape'")

vlandau commented 4 years ago

Was Pkg; Pkg.add("MbedTLS_jll") necessary to get it to work? I see you're not doing that when running from Julia.

jessjaco commented 4 years ago

Yes, I had to add that in the call from R.

vlandau commented 4 years ago

What happens when you do system("julia") -> ]add MbedTLS_jll -> using Circuitscape? Same error? I think this isn't a Circuitscape problem, so just trying to narrow it down a bit to determine who to ask for help.

jessjaco commented 4 years ago

No that works too.

vlandau commented 4 years ago

Okay -- do you have to do the same to load other packages, or just Circuitscape? Maybe try using ArchGDAL directly after system("julia") and see if the same error gets thrown

ViralBShah commented 4 years ago

I think the mbedtls library is not right. Can you try doing using Pkg; Pkg.update() to see if it gets upgraded and the problem goes away?

jessjaco commented 4 years ago

Did not help. I take it you are not seeing this error?

jessjaco commented 4 years ago

@vlandau yes I'm getting the same error using using ArchGDAL. So this is not a Circuitscape issue.

ViralBShah commented 4 years ago

Something is messed up with the Julia install. If you don't have any packages you are working on (unsaved work) in.julia/dev, I would suggest wiping .julia or some way to upgrade the mbedtls dependency.

jessjaco commented 4 years ago

Thanks, this turned out to be a local install error. I had previously used the ubuntu version of julia and removing it didn't remove libjulia1