NCDatasets precompile error

pkg> add NCDatasets gave an error message 1 dependency errored. To see a full report either run import Pkg; Pkg.precompile().

So, I did import Pkg; Pkg.precompile() and got the messages at the bottom.

I use macOS Catalina (10.15.7) and install julia by homebrew. It’s Julia stable 1.7.2.

How can one solve this problem?


Precompiling project...
  ✗ NCDatasets
  0 dependencies successfully precompiled in 2 seconds (15 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

NCDatasets [85f8d34a-cbdd-5861-8df4-14fed0d494ab]

Failed to precompile NCDatasets [85f8d34a-cbdd-5861-8df4-14fed0d494ab] to /Users/furue/.julia/compiled/v1.7/NCDatasets/jl_l1MBJh.
ERROR: LoadError: InitError: could not load library "/Users/furue/.julia/artifacts/0b92c3ca1de2e9dc46a381553278edd25af54980/lib/libnetcdf.18.dylib"
dlopen(/Users/furue/.julia/artifacts/0b92c3ca1de2e9dc46a381553278edd25af54980/lib/libnetcdf.18.dylib, 1): Library not loaded: @rpath/libmbedtls.13.dylib
  Referenced from: /Users/furue/.julia/artifacts/0b92c3ca1de2e9dc46a381553278edd25af54980/lib/libnetcdf.18.dylib
  Reason: image not found
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:117
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
  [4] __init__()
    @ NetCDF_jll ~/.julia/packages/NetCDF_jll/xjKDT/src/wrappers/x86_64-apple-darwin.jl:14
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:768
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:854
  [7] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1097
  [8] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [9] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
 [10] include
    @ ./Base.jl:418 [inlined]
 [11] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1318
 [12] top-level scope
    @ none:1
 [13] eval
    @ ./boot.jl:373 [inlined]
 [14] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [15] top-level scope
    @ none:1
during initialization of module NetCDF_jll
in expression starting at /Users/furue/.julia/packages/NCDatasets/XVX8L/src/NCDatasets.jl:1
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /usr/local/Cellar/julia/1.7.2/share/julia/stdlib/v1.7/Pkg/src/Types.jl:68
 [2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API /usr/local/Cellar/julia/1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:1362
 [3] precompile
   @ /usr/local/Cellar/julia/1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:1013 [inlined]
 [4] #precompile#220
   @ /usr/local/Cellar/julia/1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:1011 [inlined]
 [5] precompile()
   @ Pkg.API /usr/local/Cellar/julia/1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:1011
 [6] top-level scope
   @ REPL[6]:1

It’s impossible to support Homebrew Julia here since we cannot control their build process or how they integrate with dependencies.

Could you try with a version from Download Julia and see if you still have the same problem? If the problem goes away, please report the issue to Homebrew.

1 Like

Indeed seems to be an issue with Homebrew.

https://github.com/Alexander-Barth/NCDatasets.jl/issues/153

I find juliaup to work very well on MacOS, despite it being marked as prerelease.

2 Likes

Thank you folks for your help!

I naïvely thought the Homebrew package of Julia was a very thin wrapper around the official Julia package.

Instead of the regular Homebrew Julia package, I switched to the “cask” version of Homebrew, which, if I understand correctly, just downloads the official Julia package and install it.

This cask version works! (NCDatasets is installed.)

1 Like

From Homebrew, I recommend juliaup: juliaup — Homebrew Formulae . Juliaup will download official built Julia and keep you up to date.

1 Like

juliaup

Thank you for the information! I’ve also just realized that @skleinbo also mentioned it.

Now, I’m really confused. There are three different packages of Julia for Homebrew.

juliaup offers “stable 1.6.1” whereas the regular julia package and its cask version offer “stable 1.7.2”. I don’t care (so far) about backward compatibility and so I’d like to stick to a reasonably new Julia version.

Also, I don’t know details of differences between the regular and cask packages.

Perhaps I should start a new thread “What are the differences between Homebrew Julia packages?”

The version 1.6.1 is for juliaup not for Julia. juliaup can manage multiple Julia versions for you:

juliaup 1.6.1 is capable of installing Julia 1.7.2 for you. It will also update you to 1.7.3 or 1.8.0 when they are released.

1 Like

The version 1.6.1 is for juliaup not for Julia

Oops. I see. Thank you for your help. I’ve just switched to the juliaup package. It’s working.

We find this wording:

Note that the Mac and Linux version are considered prerelease, have known bugs and might often break.

I suppose that what is a prerelease is the juliaup package, not the Julia language compiler which is installed by juilaup by default. Is that correct?

Although I want the compiler to be “reasonably” up to date, I’d hesitate to use an unstable compiler. As I understand, juliaup, by default, follows the latest stable releases. This is a nice default.

The software, in Rust, was initially released as a Julia manager in the Windows store. The red extension to other platforms came later.

Please take a look at GitHub - JuliaLang/juliaup: Julia installer and version multiplexer
regarding any outstanding issues.

1 Like