jonathan-laurent / AlphaZero.jl

A generic, simple and fast implementation of Deepmind's AlphaZero algorithm.

Home Page:https://jonathan-laurent.github.io/AlphaZero.jl/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a way to use AlphaZero.jl without using Plots.jl and Gr_jll?

Snimm opened this issue · comments

Trying to import AlphaZero in google colab results in this:

[ Info: Precompiling AlphaZero [8ed9eb0b-7496-408d-8c8b-2119aeea02cd]
[ Info: Using the Flux implementation of AlphaZero.NetLib.
ERROR: LoadError: InitError: UndefVarError: GR_jll not defined
Stacktrace:
  [1] __init__()
    @ GR.GRPreferences ~/.julia/packages/GR/I1aTM/src/preferences.jl:50
  [2] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base ./loading.jl:831
  [3] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
    @ Base ./loading.jl:1039
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1315
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [6] macro expansion
    @ ./loading.jl:1180 [inlined]
  [7] macro expansion
    @ ./lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
  [9] top-level scope
    @ ~/.julia/packages/Plots/nuwp4/src/backends.jl:395
 [10] eval
    @ ./boot.jl:368 [inlined]
 [11] _initialize_backend(pkg::Plots.GRBackend)
    @ Plots ~/.julia/packages/Plots/nuwp4/src/backends.jl:394
 [12] backend(pkg::Plots.GRBackend)
    @ Plots ~/.julia/packages/Plots/nuwp4/src/backends.jl:260
 [13] backend(sym::Symbol)
    @ Plots ~/.julia/packages/Plots/nuwp4/src/backends.jl:270
 [14] load_default_backend()
    @ Plots ~/.julia/packages/Plots/nuwp4/src/backends.jl:201
 [15] backend()
    @ Plots ~/.julia/packages/Plots/nuwp4/src/backends.jl:248
 [16] top-level scope
    @ ~/.julia/packages/Plots/nuwp4/src/init.jl:123
 [17] include(mod::Module, _path::String)
    @ Base ./Base.jl:419
 [18] include(x::String)
    @ Plots ~/.julia/packages/Plots/nuwp4/src/Plots.jl:1
 [19] top-level scope
    @ ~/.julia/packages/Plots/nuwp4/src/Plots.jl:176
 [20] include
    @ ./Base.jl:419 [inlined]
 [21] 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::String)
    @ Base ./loading.jl:1554
 [22] top-level scope
    @ stdin:1
during initialization of module GRPreferences
in expression starting at /root/.julia/packages/Plots/nuwp4/src/init.jl:123
in expression starting at /root/.julia/packages/Plots/nuwp4/src/Plots.jl:1
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /root/.julia/compiled/v1.8/Plots/jl_s51kIN.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:1707
  [3] compilecache
    @ ./loading.jl:1651 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [6] macro expansion
    @ ./loading.jl:1180 [inlined]
  [7] macro expansion
    @ ./lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
  [9] include(mod::Module, _path::String)
    @ Base ./Base.jl:419
 [10] include(x::String)
    @ AlphaZero ~/.julia/packages/AlphaZero/3oiyX/src/AlphaZero.jl:6
 [11] top-level scope
    @ ~/.julia/packages/AlphaZero/3oiyX/src/AlphaZero.jl:160
 [12] include
    @ ./Base.jl:419 [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:1554
 [14] top-level scope
    @ stdin:1
in expression starting at /root/.julia/packages/AlphaZero/3oiyX/src/ui/ui.jl:1
in expression starting at /root/.julia/packages/AlphaZero/3oiyX/src/AlphaZero.jl:6
in expression starting at stdin:1
Failed to precompile AlphaZero [8ed9eb0b-7496-408d-8c8b-2119aeea02cd] to /root/.julia/compiled/v1.8/AlphaZero/jl_L5f97Q.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:1707
 [3] compilecache
   @ ./loading.jl:1651 [inlined]
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1337
 [5] _require_prelocked(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1200
 [6] macro expansion
   @ ./loading.jl:1180 [inlined]
 [7] macro expansion
   @ ./lock.jl:223 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1144

Is there a way to use this program without these dependencies? It should be possible.

There is currently no option to do this but it should be fairly easy for you to implement.

Also, did you try

export GKSwstype=100  # To avoid an occasional GR bug

as I recommended in the README?

@jonathan-laurent I tried the solution given in the readme, but it did not work. run(`export GKSwstype=100`) gives IOError: could not spawn `export GKSwstype=100`: no such file or directory (ENOENT) However I tried ENV["GKSwstype"]="100" ; pkd.add("AlphaZero")
This actually removed the GR error however the GR_jll error persisted. The total error is here. Can you look at this PR, where I added that GR bug line in the official documentation?

Also changing Plots.jl backend should solve the issue, right?