How to find package preventing others from updating

baggepinnen
Mon, 08 Jan 2018 16:50:31 +0000
General Usage

While trying to upgrade a package I found that some other package held it back with an upper version bound. To track down the offending package, I found the following function useful

function find_holdback(held_back_package, recursive = 0, installed = collect(keys(Pkg.installed())), inset=0)
    @assert held_back_package ∈ installed "The package you are querying is not installed"
    for package in installed
        REQUIRE = Pkg.dir(package, "REQUIRE")
        isfile(REQUIRE) || continue
        for line in eachline(REQUIRE)
            splitline = split(line, ' ')
            splitline[1] == held_back_package || continue
            for i = 1:inset print("    ") end
            if length(splitline) > 2
                print_with_color(:red, @sprintf("Package %-35s requires %s\n", package, line))
            else
                @printf("Package %-35s requires %s\n", package, line)
            end
            recursive > 0 && find_holdback(package, recursive-1, installed, inset+1)
        end
    end
end

julia> find_holdback("ForwardDiff", 2) # Prints requires with a depth of 2

Example output:

julia> find_holdback("ForwardDiff", 2)
Package NLsolve                                            requires ForwardDiff 0.3.0
    Package SteadyStateDiffEq                                  requires NLsolve
        Package DifferentialEquations                              requires SteadyStateDiffEq 0.0.1
    Package DiffEqCallbacks                                    requires NLsolve
        Package DifferentialEquations                              requires DiffEqCallbacks 0.0.2
    Package OrdinaryDiffEq                                     requires NLsolve 0.9.1
        Package DelayDiffEq                                        requires OrdinaryDiffEq 1.6.0
        Package DifferentialEquations                              requires OrdinaryDiffEq 2.0.0
    Package StochasticDiffEq                                   requires NLsolve
        Package DifferentialEquations                              requires StochasticDiffEq 2.0.0
    Package FiniteElementDiffEq                                requires NLsolve 0.7.3
        Package DifferentialEquations                              requires FiniteElementDiffEq 0.3.0
Package ReverseDiffSparse                                  requires ForwardDiff 0.3 0.5
    Package JuMP                                               requires ReverseDiffSparse 0.7 0.8
Package Optim                                              requires ForwardDiff 0.3.0 0.5.0
    Package NLsolve                                            requires Optim
        Package SteadyStateDiffEq                                  requires NLsolve
        Package DiffEqCallbacks                                    requires NLsolve
        Package OrdinaryDiffEq                                     requires NLsolve 0.9.1
        Package StochasticDiffEq                                   requires NLsolve
        Package FiniteElementDiffEq                                requires NLsolve 0.7.3
    Package DiffEqParamEstim                                   requires Optim
        Package DifferentialEquations                              requires DiffEqParamEstim 0.3.0
    Package KernelDensity                                      requires Optim
        Package StatPlots                                          requires KernelDensity
Package ReverseDiff                                        requires ForwardDiff 0.3.4 0.5.0
    Package LTVModels                                          requires ReverseDiff
        Package GuidedPolicySearch                                 requires LTVModels
Package DiffEqCallbacks                                    requires ForwardDiff 0.3.0
    Package DifferentialEquations                              requires DiffEqCallbacks 0.0.2
Package DiffEqParamEstim                                   requires ForwardDiff
    Package DifferentialEquations                              requires DiffEqParamEstim 0.3.0
Package Roots                                              requires ForwardDiff 0.2.0
    Package Sundials                                           requires Roots
        Package DifferentialEquations                              requires Sundials 0.11.0
    Package OrdinaryDiffEq                                     requires Roots 0.2.1
        Package DelayDiffEq                                        requires OrdinaryDiffEq 1.6.0
        Package DifferentialEquations                              requires OrdinaryDiffEq 2.0.0
    Package StochasticDiffEq                                   requires Roots
        Package DifferentialEquations                              requires StochasticDiffEq 2.0.0
Package OrdinaryDiffEq                                     requires ForwardDiff 0.2.4
    Package DelayDiffEq                                        requires OrdinaryDiffEq 1.6.0
        Package DifferentialEquations                              requires DelayDiffEq 0.3.0
    Package DifferentialEquations                              requires OrdinaryDiffEq 2.0.0
Package Flux                                               requires ForwardDiff
Package JuMP                                               requires ForwardDiff 0.3 0.5
Package StochasticDiffEq                                   requires ForwardDiff
    Package DifferentialEquations                              requires StochasticDiffEq 2.0.0

20 posts - 14 participants