netcdf.DLL library not found on Windows Server 2016

I am trying to read an exodus file using the NetCDF package. If I only add the NetCDF package to my environment than it works fine. However, when I add the package MATLAB to my environment then I get an error message related to the netcdf.DLL not being found (see below). My operating system is the Windows Server 2016 Standard.

The steps and the error that I get are outlined below.

This is the status of my environment:

(@v1.5) pkg> st
Status `C:\Users\josimar\.julia\environments\v1.5\Project.toml`
  [c52e3926] Atom v0.12.21
  [e5e0dc1b] Juno v0.8.3
  [30363a11] NetCDF v0.10.2

And in this case everything works fine:

## Example of reading an exodus file using NetCDF
using NetCDF
#using MATLAB

## This works fine
filename="test.exo"
connection=ncread(filename,"field2")

Then I add the package MATLAB:

(@v1.5) pkg> add MATLAB
   Updating registry at `C:\Users\josimar\.julia\registries\General`
  Resolving package versions...
Updating `C:\Users\josimar\.julia\environments\v1.5\Project.toml`
  [10e44e05] + MATLAB v0.7.3
Updating `C:\Users\josimar\.julia\environments\v1.5\Manifest.toml`
  [10e44e05] + MATLAB v0.7.3

(@v1.5) pkg> st
Status `C:\Users\josimar\.julia\environments\v1.5\Project.toml`
  [c52e3926] Atom v0.12.21
  [e5e0dc1b] Juno v0.8.3
  [10e44e05] MATLAB v0.7.3
  [30363a11] NetCDF v0.10.2

Now I shut down Julia and restart the session. This time now I import the MATLAB package and my previous example does not work:

## Example of reading an exodus file using NetCDF
using NetCDF
using MATLAB

## This throws and error now
filename="test.exo"
connection=ncread(filename,"field2")

The exact error message is copied below:

ERROR: LoadError: could not load library "C:\Users\josimar\.julia\conda\3\Library\bin\netcdf.DLL"
The specified procedure could not be found. 
Stacktrace:
 [1] nc_open(::String, ::UInt16, ::Array{Int32,1}) at C:\Users\josimar\.julia\packages\NetCDF\RrTZz\src\netcdf_c.jl:241
 [2] nc_open at C:\Users\josimar\.julia\packages\NetCDF\RrTZz\src\netcdf_helpers.jl:103
[inlined]
 [3] open(::String; mode::UInt16, readdimvar::Bool, add_finalizer::Bool) at C:\Users\josimar\.julia\packages\NetCDF\RrTZz\src\NetCDF.jl:910
 [4] open(::NetCDF.var"#47#48"{String}, ::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\josimar\.julia\packages\NetCDF\RrTZz\src\NetCDF.jl:996
 [5] open at C:\Users\josimar\.julia\packages\NetCDF\RrTZz\src\NetCDF.jl:996 [inlined]
 [6] #ncread#46 at C:\Users\josimar\.julia\packages\NetCDF\RrTZz\src\NetCDF.jl:1049 [inlined]
 [7] ncread(::String, ::String) at C:\Users\josimar\.julia\packages\NetCDF\RrTZz\src\NetCDF.jl:1049
 [8] top-level scope at C:\Users\josimar\Documents\test.jl
 [9] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1088
in expression starting at C:\Users\josimar\Documents\test.jl:12

Could anyone help me to figure out how to fix this error?

There probably is an incompatibility because MATLAB load its own NetCDF library copy. Can you try loading only MATLAB.jl and using the NetCDF function with MATLAB directly?

Thanks for the reply. I really would like to use the NetCDF package within Julia and be able to import the MATLAB.jl package at the same time. Calling the NetCDF from MATLAB directly, as mentioned, might work but I would prefer to avoid it.

Additionally, this problem only occurs in Windows. I have tried in both Ubuntu and MacOS and it works fine. Do you have any other suggestions?

This may be helpful to you but notice that you must install GMT first and uninstall the registered nc package before install that version (which is the same but uses a different dependency).

Funny that found this type of problem (not in Julia though) for years on Macs but never on Windows.