Unable to install package "TransformedLogDensities"

I’m getting this requirement message when trying to install TransformedLogDensities. I tried updating packages but it doesn’t help.

Unsatisfiable requirements detected for package TransformedLogDensities [f9bc47f6]:
 TransformedLogDensities [f9bc47f6] log:
 ├─possible versions are: 1.0.0-1.0.3 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions: 1.0.0-1.0.3
 └─restricted by compatibility requirements with TransformVariables [84d833dd] to versions: uninstalled — no versions left
   └─TransformVariables [84d833dd] log:
     ├─possible versions are: 0.1.0-0.8.7 or uninstalled
     ├─restricted to versions * by an explicit requirement, leaving only versions: 0.1.0-0.8.7
     └─restricted by compatibility requirements with DynamicHMCModels [6266e5bf] to versions: 0.1.0-0.3.12
       └─DynamicHMCModels [6266e5bf] log:
         ├─possible versions are: 0.1.0-2.1.4 or uninstalled
         └─restricted to versions * by an explicit requirement, leaving only versions: 0.1.0-2.1.4

Slightly weird error that you are seeing, this is clearer:

(jl_ipx5q6) pkg> add TransformedLogDensities
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package TransformVariables [84d833dd]:
 TransformVariables [84d833dd] log:
 ├─possible versions are: 0.1.0-0.8.7 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions: 0.1.0-0.8.7
 ├─restricted by compatibility requirements with TransformedLogDensities [f9bc47f6] to versions: 0.6.0-0.8.7
 │ └─TransformedLogDensities [f9bc47f6] log:
 │   ├─possible versions are: 1.0.0-1.0.3 or uninstalled
 │   └─restricted to versions * by an explicit requirement, leaving only versions: 1.0.0-1.0.3
 └─restricted by compatibility requirements with DynamicHMCModels [6266e5bf] to versions: 0.1.0-0.3.12 — no versions left
   └─DynamicHMCModels [6266e5bf] log:
     ├─possible versions are: 0.1.0-2.1.4 or uninstalled
     └─restricted to versions * by an explicit requirement, leaving only versions: 0.1.0-2.1.4

TransformedLogDensities and DynamicHMCModels rely on incompatible versions of TransformVariables as dependencies, so you can’t have them in the same environment.

1 Like

I was trying this example. If I got it right, you mean if I get rid of DynamicHMCModels it will work?

using TransformVariables, TransformedLogDensities, LogDensityProblems, LogDensityProblemsAD,
    DynamicHMC, DynamicHMC.Diagnostics, SimpleUnPack, Statistics, Random

struct BernoulliProblem
    n::Int # Total number of draws in the data
    s::Int # Number of draws `==1` in the data
end  

function (problem::BernoulliProblem)(θ)
    @unpack α = θ               # extract the parameters
    @unpack n, s = problem       # extract the data
    # log likelihood, with constant terms dropped
    s * log(α) + (n-s) * log(1-α)
end

p = BernoulliProblem(20, 10)
p((α = 0.5, )) # make sure that it works

trans = as((α = as𝕀,))
P = TransformedLogDensity(trans, p)
∇P = ADgradient(:ForwardDiff, P)

results = mcmc_with_warmup(Random.default_rng(), ∇P, 1000; reporter = NoProgressReport())

If you remove DynamicHMCModels from your environment, you will be able to add TransformedLogDensities to it. Whether your example will run I do not know, as I don’t know whether DynamicHMCModels is needed for it to run.