brian-j-smith / Mamba.jl

Markov chain Monte Carlo (MCMC) for Bayesian analysis in julia
Other
253 stars 52 forks source link

Eyes example does not work in JuliaPro 1.2.0-2 (Julia 1.2.0) #168

Open rszoh opened 4 years ago

rszoh commented 4 years ago

I am new to Julia and I really like Mamba. I seem to run into issues when I try to reproduce the Eyes example (https://mambajl.readthedocs.io/en/latest/examples/eyes.html). I get the error message below. I have no clue what is going on.

MethodError: Cannot convert an object of type Array{Float64,1} to an object of type ArrayStochastic{1} Closest candidates are: convert(::Type{T<:AbstractArray}, !Matched::T<:AbstractArray) where T<:AbstractArray at abstractarray.jl:14 convert(::Type{T<:AbstractArray}, !Matched::LinearAlgebra.Factorization) where T<:AbstractArray at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\LinearAlgebra\src\factorization.jl:46 convert(::Type{S}, !Matched::T<:(Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R)) where {S, T<:(Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R)} at C:\Users\rszoh.juliapro\JuliaPro_v1.2.0-2\packages\CategoricalArrays\dmrjI\src\value.jl:103 ... (::getfield(Distributions, Symbol("##call#23#24")))(::Bool, ::Type{DiscreteNonParametric{Int64,Float64,Base.OneTo{Int64},ArrayStochastic{1}}}, ::Base.OneTo{Int64}, ::ArrayStochastic{1}) at discretenonparametric.jl:31

call#26 at none:0 [inlined]

Type at none:0 [inlined]

Categorical#27 at categorical.jl:34 [inlined]

Type at categorical.jl:34 [inlined] (::getfield(Main, Symbol("##10#17")))(::ArrayStochastic{1}, ::Int64) at untitled-6a3806dada8e2ae419b40823edd6c231:33 (::getfield(Main, Symbol("##25#26")))(::Model) at array.jl:0 setinits!(::ArrayStochastic{1}, ::Model, ::Array{Int64,1}) at dependent.jl:173 setinits!(::Model, ::Dict{Symbol,Any}) at initialization.jl:11 setinits!(::Model, ::Array{Dict{Symbol,Any},1}) at initialization.jl:24

mcmc#23(::Int64, ::Int64, ::Int64, ::Bool, ::typeof(mcmc), ::Model, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}, ::Int64) at mcmc.jl:30

(::getfield(Mamba, Symbol("#kw##mcmc")))(::NamedTuple{(:burnin, :thin, :chains),Tuple{Int64,Int64,Int64}}, ::typeof(mcmc), ::Model, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}, ::Int64) at none:0 top-level scope at untitled-6a3806dada8e2ae419b40823edd6c231:80

brian-j-smith commented 4 years ago

This looks like an issue in the Distributions package. I've pushed a commit to the master branch with a temporary fix. Use Pkg.develop("Mamba") in Julia to get the fix.

rszoh commented 4 years ago

This looks like an issue in the Distributions package. I've pushed a commit to the master branch with a temporary fix. Use Pkg.develop("Mamba") in Julia to get the fix.

Thank you Brian! This is not working for me. I get the following error:

(v1.2) pkg> develop Mamba [ Info: Path C:\Users\rszoh\.juliapro\JuliaPro_v1.2.0-2\dev\Mamba exists and looks like the correct package, using existing path Resolving package versions... ERROR: Unsatisfiable requirements detected for package Distributions [31c24e10]: Distributions [31c24e10] log: ├─possible versions are: [0.16.0-0.16.4, 0.17.0, 0.18.0, 0.19.1-0.19.2, 0.20.0, 0.21.0-0.21.3, 0.21.5-0.21.12, 0.22.0-0.22.5] or uninstalled └─restricted to versions 0.23.0-0.23 by Mamba [5424a776] — no versions left └─Mamba [5424a776] log: ├─possible versions are: 0.12.3 or uninstalled └─Mamba [5424a776] is fixed to version 0.12.3

brian-j-smith commented 4 years ago

Pkg.update() to get the latest version of the Distributions and other packages.

rszoh commented 4 years ago

Brian, I could not that example to work in JuliaPro 1.4.0 - However, I finally download the barebone Julia 1.4.0 and things work just perfectly. It is still not really clear to me why update and/or develop still does not grab the right update of Mamba in JuliaPro 1.4.0. Thank you