Unable to use Flux

Hello, I’m trying to do reinforcement learning and deep learning with Julia. But can’t use Flux. I get an error:

┌ Info: Precompiling Flux [587475ba-b771-5e3f-ad9e-33799f191a9c]
└ @ Base loading.jl:1317
ERROR: LoadError: LoadError: LoadError: UndefVarError: __source__ not defined
Stacktrace:
  [1] var"@nograd"(__source__::LineNumberNode, __module__::Module, ex::Any)
    @ Zygote C:\Users\Uporabnik\.julia\packages\Zygote\oMScO\src\lib\grad.jl:7
  [2] include(mod::Module, _path::String)
    @ Base .\Base.jl:386
  [3] include(x::String)
    @ Zygote C:\Users\Uporabnik\.julia\packages\Zygote\oMScO\src\Zygote.jl:1
  [4] top-level scope
    @ C:\Users\Uporabnik\.julia\packages\Zygote\oMScO\src\Zygote.jl:22
  [5] include
    @ .\Base.jl:386 [inlined]
  [6] 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:1213
  [7] top-level scope
    @ none:1
  [8] eval
    @ .\boot.jl:360 [inlined]
  [9] eval(x::Expr)
    @ Base.MainInclude .\client.jl:446
 [10] top-level scope
    @ none:1
in expression starting at C:\Users\Uporabnik\.julia\packages\Zygote\oMScO\src\lib\lib.jl:30
in expression starting at C:\Users\Uporabnik\.julia\packages\Zygote\oMScO\src\lib\lib.jl:30
in expression starting at C:\Users\Uporabnik\.julia\packages\Zygote\oMScO\src\Zygote.jl:1
ERROR: LoadError: Failed to precompile Zygote [e88e6eb3-aa80-5325-afca-941959d7151f] to C:\Users\Uporabnik\.julia\compiled\v1.6\Zygote\jl_94BA.tmp.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IOContext{Base.PipeEndpoint}, internal_stdout::IOContext{Base.PipeEndpoint})
    @ Base .\loading.jl:1360
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base .\loading.jl:1306
  [4] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1021
  [5] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:914
  [6] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:901
  [7] include
    @ .\Base.jl:386 [inlined]
  [8] 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:1213
  [9] top-level scope
    @ none:1
 [10] eval
    @ .\boot.jl:360 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude .\client.jl:446
 [12] top-level scope
    @ none:1
in expression starting at C:\Users\Uporabnik\.julia\packages\Flux\2i5P1\src\Flux.jl:1
Failed to precompile Flux [587475ba-b771-5e3f-ad9e-33799f191a9c] to C:\Users\Uporabnik\.julia\compiled\v1.6\Flux\jl_901F.tmp.

Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IJulia.IJuliaStdio{Base.PipeEndpoint}, internal_stdout::IJulia.IJuliaStdio{Base.PipeEndpoint})
   @ Base .\loading.jl:1360
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base .\loading.jl:1306
 [4] _require(pkg::Base.PkgId)
   @ Base .\loading.jl:1021
 [5] require(uuidkey::Base.PkgId)
   @ Base .\loading.jl:914
 [6] require(into::Module, mod::Symbol)
   @ Base .\loading.jl:901
 [7] eval
   @ .\boot.jl:360 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base .\loading.jl:1094

What am I doing wrong, I tried removing and reinstalling flux and doing build Flux.
Please help!
Thanks in advance!

It is difficult to help, if you do not provide any details. Have you tried a clean environment? Which OS do you use? Which version of Julia?

1 Like

I use Windows and Julia 1.6.2. I don’t know what do you mean with

Have you tried a clean environment?

How do I do that?

Start a new Julia session and ] activate --temp

1 Like

I did it now it is giving me some environment jl_DZdLbt and it said activated, how do I use this environment.

In this temporary environment, you can check if ]add Flux and using Flux works.
If yes, the problem is with your default environment. Switch back to it by ]activate. There, you can try e.g. ]up, or ]rm Flux ]add Flux

4 Likes