TuringLang / Turing.jl

Bayesian inference with probabilistic programming.
https://turinglang.org
MIT License
2.04k stars 219 forks source link

Turing build error: could not import MCMCChains.AbstractChains into Turing #1195

Closed uozden closed 4 years ago

uozden commented 4 years ago

First of all, best wishes for safety and wellbeing.


[ Info: Precompiling Turing [fce5fe82-541a-59a6-adf8-730c64b5f9a0]
WARNING: could not import MCMCChains.AbstractChains into Turing
ERROR: LoadError: LoadError: UndefVarError: AbstractChains not defined
Stacktrace:
 [1] include(::Module, ::String) at .\Base.jl:377
 [2] include(::String) at C:\Users\.....\.julia\packages\Turing\xFzfF\src\Turing.jl:1
 [3] top-level scope at C:\Users\....\.julia\packages\Turing\xFzfF\src\Turing.jl:124
 [4] include(::Module, ::String) at .\Base.jl:377
 [5] top-level scope at none:2
 [6] eval at .\boot.jl:331 [inlined]
 [7] eval(::Expr) at .\client.jl:449
 [8] top-level scope at .\none:3
in expression starting at C:\Users\-...\.julia\packages\Turing\xFzfF\src\utilities\Utilities.jl:6
in expression starting at C:\Users\...\.julia\packages\Turing\xFzfF\src\Turing.jl:124
ERROR: Failed to precompile Turing [fce5fe82-541a-59a6-adf8-730c64b5f9a0] to C:\Users\........\.julia\compiled\v1.4\Turing\gm4QC_xLDiA.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1272
 [3] _require(::Base.PkgId) at .\loading.jl:1029
 [4] require(::Base.PkgId) at .\loading.jl:927
 [5] require(::Module, ::Symbol) at .\loading.jl:922
``
My system and Environment;

`` julia> versioninfo()
Julia Version 1.4.0
Commit b8e9a9ecc6 (2020-03-21 16:36 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
  JULIA_MATHKERNEL = C:\Program Files\Wolfram Research\Wolfram Engine\12.0\MathKernel.exe
  JULIA_MATHLINK = C:\Program Files\Wolfram Research\Wolfram Engine\12.0\SystemFiles\Activation\Windows-x86-64\ml64i4.dll ``
cpfiffer commented 4 years ago

A package in your environment is prohibiting you from using the most recent version of Turing, 0.10.1. Try typing ] add Turing@0.10.1 to see which packages are doing this.

uozden commented 4 years ago

@cpfiffer Thank you for your reply. Here is the outcome;

(@v1.4) pkg> add Turing@0.10.1 Resolving package versions... ERROR: Unsatisfiable requirements detected for package Bijectors [76274a88]: Bijectors [76274a88] log: ├─possible versions are: [0.1.0, 0.2.0, 0.2.5-0.2.9, 0.3.0-0.3.2, 0.4.0, 0.5.0-0.5.2, 0.6.0-0.6.6] or uninstalled ├─restricted by compatibility requirements with Turing [fce5fe82] to versions: 0.6.4-0.6.6 │ └─Turing [fce5fe82] log: │ ├─possible versions are: [0.5.0-0.5.1, 0.6.0-0.6.2, 0.6.4-0.6.9, 0.6.11-0.6.15, 0.6.17-0.6.19, 0.6.21-0.6.23, 0.7.0-0.7.4, 0.8.0-0.8.3, 0.9.0-0.9.2, 0.10.0-0.10.1] or uninstalled │ └─restricted to versions 0.10.1 by an explicit requirement, leaving only versions 0.10.1 └─restricted by compatibility requirements with Compat [34da2185] to versions: [0.1.0, 0.2.0, 0.2.5-0.2.9, 0.3.0-0.3.2, 0.4.0, 0.5.0-0.5.2] or uninstalled — no versions left └─Compat [34da2185] log: ├─possible versions are: [1.0.0-1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0-1.5.1, 2.0.0, 2.1.0, 2.2.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0-3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0] or uninstalled ├─restricted by compatibility requirements with LIBSVM [b1bec4e5] to versions: [1.0.0-1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0-1.5.1, 2.0.0, 2.1.0, 2.2.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0-3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0] │ └─LIBSVM [b1bec4e5] log: │ ├─possible versions are: [0.2.0, 0.3.0-0.3.1, 0.4.0] or uninstalled │ └─restricted to versions * by an explicit requirement, leaving only versions [0.2.0, 0.3.0-0.3.1, 0.4.0] └─restricted by compatibility requirements with Suppressor [fd094767] to versions: [1.0.0-1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0-1.5.1, 2.0.0, 2.1.0, 2.2.0] └─Suppressor [fd094767] log: ├─possible versions are: 0.1.1 or uninstalled └─restricted to versions * by SpineInterface [0cda1612], leaving only versions 0.1.1 └─SpineInterface [0cda1612] log: ├─possible versions are: 0.1.0 or uninstalled └─SpineInterface [0cda1612] is fixed to version 0.1.0

cpfiffer commented 4 years ago

That is incredibly difficult to read without the original formatting. Put your code in three backticks, like this:

here is some code that maintains all the spacing

Things you can do while you fix the formatting:

  1. Remove all your packages and start from a fresh environment, by deleting everything in "C:\Users\your_username\.julia\environments\v1.4\" and then running Julia and calling ] add Turing first.
  2. You can use a local environment by activating the directory you are in with ] activate . and then ] add Turing.
  3. Try updating everything first with ] update.
  4. Manually go through the list of packages that are blocking your update (listed when you call ] add Turing@0.10.1) and remove them.

In any case you can validate your package version with ] status. If you do not see 0.10.1, you are not in the right spot yet.

uozden commented 4 years ago

@cpfiffer Thank you for your response. Here it is;

Updating registry at `C:\Users\....\.julia\registries\General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Bijectors [76274a88]:
 Bijectors [76274a88] log:
 ├─possible versions are: [0.1.0, 0.2.0, 0.2.5-0.2.9, 0.3.0-0.3.2, 0.4.0, 0.5.0-0.5.2, 0.6.0-0.6.6] or uninstalled
 ├─restricted by compatibility requirements with Turing [fce5fe82] to versions: 0.6.4-0.6.6
 │ └─Turing [fce5fe82] log:
 │   ├─possible versions are: [0.5.0-0.5.1, 0.6.0-0.6.2, 0.6.4-0.6.9, 0.6.11-0.6.15, 0.6.17-0.6.19, 0.6.21-0.6.23, 0.7.0-0.7.4, 0.8.0-0.8.3, 0.9.0-0.9.2, 0.10.0-0.10.1] or uninstalled
 │   └─restricted to versions 0.10.1 by an explicit requirement, leaving only versions 0.10.1
 └─restricted by compatibility requirements with Compat [34da2185] to versions: [0.1.0, 0.2.0, 0.2.5-0.2.9, 0.3.0-0.3.2, 0.4.0, 0.5.0-0.5.2] or uninstalled — no versions left
   └─Compat [34da2185] log:
     ├─possible versions are: [1.0.0-1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0-1.5.1, 2.0.0, 2.1.0, 2.2.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0-3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0] or uninstalled
     ├─restricted by compatibility requirements with LIBSVM [b1bec4e5] to versions: [1.0.0-1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0-1.5.1, 2.0.0, 2.1.0, 2.2.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0-3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0]
     │ └─LIBSVM [b1bec4e5] log:
     │   ├─possible versions are: [0.2.0, 0.3.0-0.3.1, 0.4.0] or uninstalled
     │   └─restricted to versions * by an explicit requirement, leaving only versions [0.2.0, 0.3.0-0.3.1, 0.4.0]
     └─restricted by compatibility requirements with Suppressor [fd094767] to versions: [1.0.0-1.0.1, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0-1.5.1, 2.0.0, 2.1.0, 2.2.0]
       └─Suppressor [fd094767] log:
         ├─possible versions are: 0.1.1 or uninstalled
         └─restricted to versions * by SpineInterface [0cda1612], leaving only versions 0.1.1
           └─SpineInterface [0cda1612] log:
             ├─possible versions are: 0.1.0 or uninstalled
             └─SpineInterface [0cda1612] is fixed to version 0.1.0
cpfiffer commented 4 years ago
  • Remove all your packages and start from a fresh environment, by deleting everything in "C:\Users\your_username\.julia\environments\v1.4\" and then running Julia and calling ] add Turing first.

  • You can use a local environment by activating the directory you are in with ] activate . and then ] add Turing.

  • Try updating everything first with ] update.

  • Manually go through the list of packages that are blocking your update (listed when you call ] add Turing@0.10.1) and remove them.

Did you try any of the above?

uozden commented 4 years ago

@cpfiffer Yes. I did all, except the first bullet point, with no success.

cpfiffer commented 4 years ago

The second bullet point should have solved your problem with certainty, and the fourth definitely should have, so I don't think they were done correctly. I would do the first because it is essentially fool-proof.

uozden commented 4 years ago

@cpfiffer, It seems the main issue is that Turing could not import MCMCChains.AbstractChains into Turing while building.

cpfiffer commented 4 years ago

Yes, and I have provided you numerous fixes for that problem.

mohamed82008 commented 4 years ago

The problem is Suppressor, it is not compatible with Compat 3.x which the latest Bijectors used by the latest Turing requires.

mohamed82008 commented 4 years ago

It seems Suppressor wasn't updated for a long time.

uozden commented 4 years ago

@mohamed82008 thanks for your reply. Actually it seems Suppressor updating/building as copied below. But Turing does give the same error.

  Resolving package versions...
   Updating `C:\Users\....\.julia\environments\v1.4\Project.toml`
  [fd094767] + Suppressor v0.1.1
   Updating `C:\Users\....\.julia\environments\v1.4\Manifest.toml`
 [no changes]

(@v1.4) pkg> up Suppressor
   Updating registry at `C:\Users\....\.julia\registries\General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Updating `C:\Users\...\.julia\environments\v1.4\Project.toml`
 [no changes]
   Updating `C:\Users\......\.julia\environments\v1.4\Manifest.toml`
  [0bf59076] ↓ AdvancedHMC v0.2.21 ⇒ v0.2.7
  [4c555306] ↑ ArrayLayouts v0.1.5 ⇒ v0.2.0
  [aae01518] ↑ BandedMatrices v0.14.3 ⇒ v0.15.0
  [764a87c0] ↓ BoundaryValueDiffEq v2.4.0 ⇒ v2.3.0
  [781609d7] + GMP_jll v6.1.2+5
  [5078a376] ↑ LazyArrays v0.15.1 ⇒ v0.16.0
  [2ce0c516] + MPC_jll v1.1.0+0
  [3a97d323] + MPFR_jll v4.0.2+2
  [123dc426] ↑ SymEngine v0.7.1 ⇒ v0.8.0
  [3428059b] + SymEngine_jll v0.6.0+0
  [e88e6eb3] ↓ Zygote v0.4.12 ⇒ v0.4.8

(@v1.4) pkg> build Suppressor

julia> using Suppressor

(@v1.4) pkg> build Turing
mohamed82008 commented 4 years ago

No you should remove Suppressor.

uozden commented 4 years ago

@mohamed82008 Thanks. removed but does not help Turing building. It seems Turing is not ready for use. I will leave it there and switch to Stan.jl

cpfiffer commented 4 years ago

You need to update after removing Suppressor. FYI, the problem is not Turing here, it is your package environment.

mohamed82008 commented 4 years ago

Try ]add Turing@0.10.1 after removing Suppressor.

mohamed82008 commented 4 years ago

It seems Turing is not ready for use. I will leave it there and switch to Stan.jl

There are a number of people out there using Turing so it is ready for use, but of course you are free to switch to Stan any time, good luck :)

xukai92 commented 4 years ago

Following option 2 from https://github.com/TuringLang/Turing.jl/issues/1195#issuecomment-606107330, you will have below:

(base) ➜  tmp julia-1.4
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.0 (2020-03-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.4) pkg> activate .
 Activating new environment at `~/projects/tmp/Project.toml`

(tmp) pkg> st
Status `~/projects/tmp/Project.toml`
  (empty environment)

(tmp) pkg> add Turing
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Resolving package versions...
   Updating `~/projects/tmp/Project.toml`
  [fce5fe82] + Turing v0.10.1
   Updating `~/projects/tmp/Manifest.toml`
  [621f4979] + AbstractFFTs v0.5.0
  [80f14c24] + AbstractMCMC v0.5.6
  [1520ce14] + AbstractTrees v0.3.2
  [79e6a3ab] + Adapt v1.0.1
  [0bf59076] + AdvancedHMC v0.2.21
  [5b7e9947] + AdvancedMH v0.4.1
  [dce04be8] + ArgCheck v2.0.0
  [7d9fca2a] + Arpack v0.4.0
  [68821587] + Arpack_jll v3.5.0+2
  [4fba245c] + ArrayInterface v2.6.2
  [4c555306] + ArrayLayouts v0.1.5
  [39de3d68] + AxisArrays v0.4.2
  [6e4b80f9] + BenchmarkTools v0.5.0
  [76274a88] + Bijectors v0.6.6
  [b99e7846] + BinaryProvider v0.5.8
  [861a8166] + Combinatorics v1.0.0
  [bbf7d656] + CommonSubexpressions v0.2.0
  [34da2185] + Compat v3.8.0
  [e66e0078] + CompilerSupportLibraries_jll v0.3.3+0
  [88cd18e8] + ConsoleProgressMonitor v0.1.2
  [9a962f9c] + DataAPI v1.1.0
  [864edb3b] + DataStructures v0.17.10
  [163ba53b] + DiffResults v1.0.2
  [b552c78f] + DiffRules v1.0.1
  [31c24e10] + Distributions v0.23.2
  [ced4e74d] + DistributionsAD v0.4.9
  [ffbed154] + DocStringExtensions v0.8.1
  [366bfd00] + DynamicPPL v0.5.0
  [da5c29d0] + EllipsisNotation v0.4.0
  [cad2338a] + EllipticalSliceSampling v0.2.1
  [7a1cc6ca] + FFTW v1.2.0
  [f5851436] + FFTW_jll v3.3.9+5
  [1a297f60] + FillArrays v0.8.6
  [59287772] + Formatting v0.4.1
  [f6369f11] + ForwardDiff v0.10.10
  [069b7b12] + FunctionWrappers v1.1.1
  [7869d1d1] + IRTools v0.3.1
  [505f98c9] + InplaceOps v0.3.0
  [1d5cc7b8] + IntelOpenMP_jll v2018.0.3+0
  [8197267c] + IntervalSets v0.4.0
  [c8e1da08] + IterTools v1.3.0
  [682c06a0] + JSON v0.21.0
  [5078a376] + LazyArrays v0.15.1
  [1d6d02ad] + LeftChildRightSiblingTrees v0.1.2
  [6f1fad26] + Libtask v0.3.3
  [6fdf6af0] + LogDensityProblems v0.10.3
  [e6f89c97] + LoggingExtras v0.4.0
  [c7f686f2] + MCMCChains v3.0.8
  [856f044c] + MKL_jll v2019.0.117+2
  [1914dd2f] + MacroTools v0.5.5
  [dbb5928d] + MappedArrays v0.2.2
  [e1d29d7a] + Missings v0.4.3
  [872c559c] + NNlib v0.6.6
  [77ba4419] + NaNMath v0.3.3
  [4536629a] + OpenBLAS_jll v0.3.9+0
  [efe28fd5] + OpenSpecFun_jll v0.5.3+3
  [bac558e1] + OrderedCollections v1.1.0
  [90014a1f] + PDMats v0.9.12
  [d96e819e] + Parameters v0.12.0
  [69de0a69] + Parsers v1.0.0
  [f27b6e38] + Polynomials v0.6.1
  [33c8b6b6] + ProgressLogging v0.1.2
  [92933f4c] + ProgressMeter v1.2.0
  [1fd47b50] + QuadGK v2.3.1
  [b3c3ace0] + RangeArrays v0.3.2
  [3cdcf5f2] + RecipesBase v0.8.0
  [189a3867] + Reexport v0.2.0
  [ae029012] + Requires v1.0.1
  [37e2e3b7] + ReverseDiff v1.1.0
  [79098fc4] + Rmath v0.6.1
  [f50d1b31] + Rmath_jll v0.2.2+0
  [f2b01f46] + Roots v1.0.1
  [a2af1166] + SortingAlgorithms v0.3.1
  [276daf66] + SpecialFunctions v0.10.0
  [90137ffa] + StaticArrays v0.12.1
  [2913bbd2] + StatsBase v0.32.2
  [4c63d2b9] + StatsFuns v0.9.4
  [5d786b92] + TerminalLoggers v0.1.1
  [9f7883ad] + Tracker v0.2.6
  [84d833dd] + TransformVariables v0.3.8
  [fce5fe82] + Turing v0.10.1
  [e88e6eb3] + Zygote v0.4.12
  [700de1a5] + ZygoteRules v0.2.0
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8bb1440f] + DelimitedFiles
  [8ba89e20] + Distributed
  [b77e0a4c] + InteractiveUtils
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [1a1011a3] + SharedArrays
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [4607b0f0] + SuiteSparse
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode

julia> using Turing
[ Info: Precompiling Turing [fce5fe82-541a-59a6-adf8-730c64b5f9a0]
   Building Libtask → `~/.julia/packages/Libtask/K7OAU/deps/build.log`

julia> 

After this Turing is ready to use.

In the meanwhile, I suggest you spent some time learning how to deal with the environment in Julia. Some intro materials are available at https://julialang.github.io/Pkg.jl/stable/environments/ and https://docs.julialang.org/en/v1/stdlib/Pkg/. It's quite necessary to understand how it works in order to use Julia efficiently and properly.

mohamed82008 commented 4 years ago

Closing this for now. @uozden feel free to re-open the issue if the above solutions don't work for you.

uozden commented 4 years ago

@cpfiffer @mohamed82008 @xukai92 Thank you very much. I have solved the problem with your kind help