Assume some Julia code adds a package pkg
via Pkg.add(pkg)
. How can subsequent code determine if the package precompiled successfully?
If precompilation did not succeed, then there will be an error when trying to use import
or using
.
Well, is there a way without using import
or using
(without restarting Julia)? The problem is that you cannot undo such a command. For example, the following leads to an error:
using Pkg
Pkg.activate(; temp = true)
Pkg.add("AxisKeys")
import AxisKeys
Pkg.activate(; temp = true)
Pkg.add("FFTViews")
import FFTViews
It gives
┌ Error: Error during loading of extension AbstractFFTsExt of NamedDims, use `Base.retry_load_extensions()` to retry.
│ exception =
│ 1-element ExceptionStack:
│ ArgumentError: Package AbstractFFTsExt [ec604236-bdd8-5045-8fae-50e3b7893c8a] is required but does not seem to be installed:
│ - Run `Pkg.instantiate()` to install all recorded dependencies.
[...]
└ @ Base loading.jl:1301
┌ Error: Error during loading of extension AbstractFFTsExt of AxisKeys, use `Base.retry_load_extensions()` to retry.
│ exception =
│ 1-element ExceptionStack:
│ ArgumentError: Package AbstractFFTsExt [7cd4eef3-a486-5c57-b280-f5e9e842d192] is required but does not seem to be installed:
│ - Run `Pkg.instantiate()` to install all recorded dependencies.
Without the first import
it works fine.