# Does the GMT.jl package conflict with the MAT.jl and NCDatasets.jl packages?

**URL:** <https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639>\
**Category:** General Usage\
**Tags:** question, gmt\
**Created:** [October 29, 2021, 8:20pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639 "2021-10-29T20:20:18Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 29, 2021, 8:20pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/1 "2021-10-29T20:20:18Z")

</div>

I have a very weird situation.

I can plot a map using my GMT.jl package. I can also load my NetCDF data using NCDatasets.jl without any issues. However, if I first use NCDatasets.jl to load the data in and then use GMT.jl to plot in the same program, `using GMT` will give me the below error.

According to the error message, the reason seems to be “ **Incompatible library version: libgdal.29.dylib requires version 202.0.0 or later, but libhdf5.200.dylib provides version 201.0.0** ”.

```julia
**ERROR:** LoadError: InitError: could not load library "/Users/xxx/.julia/conda/3/lib/libgdal.29.dylib"

dlopen(/Users/xxx/.julia/conda/3/lib/libgdal.29.dylib, 1): Library not loaded: @rpath/libhdf5.200.dylib

Referenced from: /Users/xxx/.julia/conda/3/lib/libgdal.29.dylib

Reason: Incompatible library version: libgdal.29.dylib requires version 202.0.0 or later, but libhdf5.200.dylib provides version 201.0.0

Stacktrace:

[1] **GDALVersionInfo(** a1::String **)**

@ GMT.Gdal ~/.julia/packages/GMT/TPV4a/src/gdal.jl:317

[2] ** __init__ ()**

@ GMT.Gdal ~/.julia/packages/GMT/TPV4a/src/gdal.jl:2403

[3] **_include_from_serialized(** path::String, depmods::Vector{Any} **)**

@ Base ./loading.jl:768

[4] **_require_search_from_serialized(** pkg::Base.PkgId, sourcepath::String **)**

@ Base ./loading.jl:854

[5] **_require(** pkg::Base.PkgId **)**

@ Base ./loading.jl:1097

[6] **require(** uuidkey::Base.PkgId **)**

@ Base ./loading.jl:1013

[7] **require(** into::Module, mod::Symbol **)**

@ Base ./loading.jl:997

during initialization of module Gdal

in expression starting at /Users/xxx/Desktop/Julia_CODAP/Plotting_GMT.jl:20

(base) MacBook-Pro Julia_CODAP %

```

Anyone has seen that issue before? I’m using Julia on Mac OS Big Sur, BTW. Many thanks.

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 29, 2021, 10:33pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/2 "2021-10-29T22:33:22Z")

</div>

I tried to convert the gridded data from NetCDF to MAT file so that I could avoid the use of the NCDatasets package. However, the MAT package caused the same error.

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [October 29, 2021, 11:09pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/3 "2021-10-29T23:09:53Z")

</div>

Can you try loading in the inverse order?

```julia
using GMT
using NCDatasets

```

I don’t have an explanation but I used to have a similar problem with JLD, it may be related because all three use the HDF5 library.

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 29, 2021, 11:14pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/4 "2021-10-29T23:14:48Z")

</div>

Thank you so much! It works 👍 👍

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [October 29, 2021, 11:16pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/5 "2021-10-29T23:16:50Z")

</div>

I’m trying to find the relevant github issue, but It would be nice if you could open one at NCDatasets and GMT, just in case some else finds it. I seem to remember it was a problem in the HDF5 library, not sure.

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 29, 2021, 11:25pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/6 "2021-10-29T23:25:08Z")

</div>

OK. Will do.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 29, 2021, 11:42pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/7 "2021-10-29T23:42:08Z")

</div>

What can I say. That is unix and its normal dependencies conflicts. I have this [NCDatasets.jl](https://github.com/joa-quim/NCDatasets.jl) fork that uses the GDAL, netCDF, (train of shared libs) provided by GMT and should protect from those lib conflicts.

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 29, 2021, 11:49pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/8 "2021-10-29T23:49:23Z")

</div>

Cool. Is that fork easy to setup? Any details to share?

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 30, 2021, 12:04am UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/9 "2021-10-30T00:04:18Z")

</div>

Sorry, that one from a package of 4 and it’s the only one that has no install instructions (and the fork is ~ 1 year old). To install, first remove your current `NCDatasets` and then do

```julia
] add https://github.com/joa-quim/NCDatasets.jl

```

Note, all of this is reversible. If not satisfied remove this and re-install the official one.

---

<div class="post-metadata">

**Author:** ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Post date:** [October 30, 2021, 9:46am UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/10 "2021-10-30T09:46:11Z")

</div>

I am wondering why we have this library conflict. Does GMT.jl use its own hdf5/NetCDF library (or system libraries) rather than using Julia’s NetCDF\_jll? If yes, would building GMT on Yggdrasil not be the better solution?

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [October 30, 2021, 10:11am UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/11 "2021-10-30T10:11:35Z")

</div>

Many thanks, Joa-quim!

Unfortunately, I got the below error:

```julia
**julia>** ] add https://github.com/joa-quim/NCDatasets.jl
**ERROR:** syntax: unexpected "]"

```

So I tried to use `Pkg.add(url="")` to install it. It seems to be installed successfully, but when I run my program, the `using NCDatasets` syntax gives me a page-long error that started as the below:

` **ERROR:** LoadError: This package can only be installed in systems that have GMT`

That’s strange, because I do have the GMT package, and I’m able to use it to make plots.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 30, 2021, 3:11pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/12 "2021-10-30T15:11:29Z")

</div>

> Does GMT.jl use its own hdf5/NetCDF library (or system libraries) rather than using Julia’s NetCDF\_jll?

GMT.jl no, but the GMT C lib yes.

> [@Alexander-Barth](#):
>
> If yes, would building GMT on Yggdrasil not be the better solution?

I would love to, but two big stones in the way

- Yggdarsil/ BinaryBuilder doesn’t work from Windows
- GDAL\_jll is not build with netCDF and HDF support. This is a killing feature to GMT.

---

<div class="post-metadata">

**Author:** ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Post date:** [October 30, 2021, 9:36pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/13 "2021-10-30T21:36:24Z")

</div>

I am wondering if alternatively, you could use the `Preferences` module to override the location of HDF5/NetCDF4 and to point to the libraries of the GMT package.  
For example:  
[https://github.com/Alexander-Barth/NCDatasets.jl/issues/126#issuecomment-818045715](https://github.com/Alexander-Barth/NCDatasets.jl/issues/126#issuecomment-818045715)

Would this achieve the same as your fork of NCDatasets?  
I had similar problem in the past with zlib (pre-BinaryBuild which solved such problems for me). I used the LD\_PRELOAD trick ([https://github.com/Alexander-Barth/NCDatasets.jl/issues/126#issuecomment-817198014](https://github.com/Alexander-Barth/NCDatasets.jl/issues/126#issuecomment-817198014)) to pre-load the right library (you can pre-load multiple libraries if they are separated by a [space](https://stackoverflow.com/a/8474666/3801401) . But LD\_PRELOAD might be Unix (or Linux) specific.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 30, 2021, 11:46pm UTC](https://discourse.julialang.org/t/does-the-gmt-jl-package-conflict-with-the-mat-jl-and-ncdatasets-jl-packages/70639/14 "2021-10-30T23:46:55Z")

</div>

I will try to give another look at this but basically this fork was for my own usage where, on Windows, there is no risk of conflicts with netCDF artifact dlls.
