Why is this Project.toml compat not enforced?

Hi everyone,

I have trouble understanding the following behavior that I tested on Julia 1.6.4 and 1.7.0. If I create an empty project and ] add PotentialFlow, this package cannot be imported because of the following error:

julia> import PotentialFlow
[ Info: Precompiling PotentialFlow [73af2aaf-3f58-5b29-82a9-435ecf827f5b]
ERROR: LoadError: UndefVarError: vector_mode_dual_eval not defined
Stacktrace:
  [1] getproperty(x::Module, f::Symbol)
    @ Base ./Base.jl:35
  [2] top-level scope
    @ ~/.julia/packages/PotentialFlow/TKJBD/src/autodiff/apiutils.jl:47
  [3] include(mod::Module, _path::String)
    @ Base ./Base.jl:418
  [4] include(x::String)
    @ PotentialFlow.Utils ~/.julia/packages/PotentialFlow/TKJBD/src/Utils.jl:1
  [5] top-level scope
    @ ~/.julia/packages/PotentialFlow/TKJBD/src/autodiff/forwarddiff.jl:19
  [6] include(mod::Module, _path::String)
    @ Base ./Base.jl:418
  [7] include(x::String)
    @ PotentialFlow.Utils ~/.julia/packages/PotentialFlow/TKJBD/src/Utils.jl:1
  [8] top-level scope
    @ ~/.julia/packages/PotentialFlow/TKJBD/src/Utils.jl:132
  [9] include(mod::Module, _path::String)
    @ Base ./Base.jl:418
 [10] include(x::String)
    @ PotentialFlow ~/.julia/packages/PotentialFlow/TKJBD/src/PotentialFlow.jl:3
 [11] top-level scope
    @ ~/.julia/packages/PotentialFlow/TKJBD/src/PotentialFlow.jl:8
 [12] include
    @ ./Base.jl:418 [inlined]
 [13] 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
 [14] top-level scope
    @ none:1
 [15] eval
    @ ./boot.jl:373 [inlined]
 [16] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [17] top-level scope
    @ none:1
in expression starting at /Users/b/.julia/packages/PotentialFlow/TKJBD/src/autodiff/apiutils.jl:47
in expression starting at /Users/b/.julia/packages/PotentialFlow/TKJBD/src/autodiff/forwarddiff.jl:19
in expression starting at /Users/b/.julia/packages/PotentialFlow/TKJBD/src/Utils.jl:1
in expression starting at /Users/b/.julia/packages/PotentialFlow/TKJBD/src/PotentialFlow.jl:3
ERROR: Failed to precompile PotentialFlow [73af2aaf-3f58-5b29-82a9-435ecf827f5b] to /Users/b/.julia/compiled/v1.7/PotentialFlow/jl_Kcuiy4.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1466
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1410
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1120
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1013
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:997

The error appears because vector_mode_dual_eval of the package ForwardDiff.jl changed in version 0.10.20 to vector_mode_dual_eval!. However, PotentialFlow.jl has the following [compat] entry for ForwardDiff.jl in its Project.toml:

ForwardDiff = "0.10.12"

but it seems that according to the manifest for the project, the latest version (0.10.23) is used for FowardDiff.jl. Furthermore, it seems like none of the other [compat] entries are enforced either. Why is this the case and how should I prevent this behavior?

Any information is greatly appreciated.

ForwardDiff = "0.10.12"

means any 0.10.* version greater or equal to 0.10.12, see here.

You can manually do add ForwardDiff@0.10.12 if that’s what you want.

3 Likes

Also, if you want a [compat] entry that only allows ForwardDiff 0.10.12, this is what you would put in the [compat] section of your Project.toml file:

[compat]
ForwardDiff = "=0.10.12"
2 Likes