JunoLab / Weave.jl

Scientific reports/literate programming for Julia
http://weavejl.mpastell.com
MIT License
830 stars 96 forks source link

[BUG] InitError: Evaluation into the closed module `Markdown` #356

Closed baggepinnen closed 4 years ago

baggepinnen commented 4 years ago

description

I just updated to julia v1.5 and when loading my package LiterateWeave which depends on both Literate and Weave, I get the error reproduced below. This package works well under julia v1.4 so I assume it's something that has changed since then. LiterateWeave does no evaluation using eval, in fact, it's entire source code is given by

function literateweave(source, doctype="md2html", args...; weave=weave, credit=false, kwargs...)
    tmpname = tempname()
    Literate.markdown(source, tmpname, documenter=false, credit=credit)
    if source[end-1:end] == "jl"
      sourcename = source[1:end-2] * "md"
    else
      @error "Need .jl file!"
    end
    sourcename = match(r"(\w+.md)", sourcename)[1]
    sourcename = joinpath(tmpname,sourcename)
    jmdsource = replace(sourcename,".md"=>".jmd")
    run(`cp $(sourcename) $(jmdsource)`)
    if doctype == "md2html" && get(kwargs, :template, nothing) == nothing && weave == Weave.weave
      template = joinpath(@__DIR__(), "..", "assets", "html.tpl")
      weave(jmdsource, args...; template=template, kwargs...)
    else
      weave(jmdsource, args...; kwargs...)
    end
end

so I assume the error is on the Weave side, likely here https://github.com/JunoLab/Weave.jl/blob/1e9ba19db499675b3201d0d700a8ab14e2f801ed/src/WeaveMarkdown/markdown.jl#L13

versions

julia> versioninfo()
Julia Version 1.5.0-DEV.876
Commit 0c388fc340 (2020-05-07 20:12 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, sandybridge)
Environment:
  JULIA_NUM_THREADS = 4
  JULIA_EDITOR = atom

(@v1.5) pkg> st
Status `~/.julia/environments/v1.5/Project.toml`
  [f20549b4] AlphaStableDistributions v0.1.1
  [c52e3926] Atom v0.12.11
  [70b36510] AutomaticDocstrings v0.1.1 `~/.julia/dev/AutomaticDocstrings`
  [6e4b80f9] BenchmarkTools v0.5.0
  [3cb15238] ChangePrecision v1.0.0
  [3a865a2d] CuArrays v2.2.0 `https://github.com/JuliaGPU/CuArrays.jl.git#master`
  [717857b8] DSP v0.6.7
  [b4f34e82] Distances v0.8.2
  [31c24e10] Distributions v0.23.2
  [aaaaaaaa] DynamicAxisWarping v0.2.1 `~/.julia/dev/DynamicAxisWarping`
  [7a1cc6ca] FFTW v1.2.1
  [28b8d3ca] GR v0.49.1
  [5cadff95] JuliennedArrays v0.2.2
  [e5e0dc1b] Juno v0.8.2
  [26dcc766] LPVSpectral v0.3.0 `~/.julia/dev/LPVSpectral`
  [98b081ad] Literate v2.5.0
  [43172d54] LiterateWeave v0.1.0 `~/.julia/dev/LiterateWeave`
  [24e37439] MatrixProfile v0.1.2 `~/.julia/dev/MatrixProfile`
  [0987c9cc] MonteCarloMeasurements v0.8.10 `~/.julia/dev/MonteCarloMeasurements`
  [1dea7af3] OrdinaryDiffEq v5.38.2
  [9b87118b] PackageCompiler v1.1.1
  [58dd65bb] Plotly v0.3.0
  [91a5bcdd] Plots v1.3.3
  [476501e8] SLEEFPirates v0.5.0
  [25b0cc0c] SlidingDistancesBase v0.1.4 `~/.julia/dev/SlidingDistancesBase`
  [2b0dec9d] SpectralDistances v0.1.2 `~/.julia/dev/SpectralDistances`
  [90137ffa] StaticArrays v0.12.3
  [dbf13d8f] ThreadTools v0.2.0 `~/.julia/dev/ThreadTools`
  [fce5fe82] Turing v0.13.0
  [8149f6b0] WAV v1.0.3
  [44d3d7a6] Weave v0.10.2
julia> using LiterateWeave
[ Info: Precompiling LiterateWeave [43172d54-7163-11e9-1466-ff355c947c6f]
ERROR: LoadError: InitError: Evaluation into the closed module `Markdown` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `Markdown` with `eval` during precompilation - don't do this.
Stacktrace:
 [1] eval at ./boot.jl:331 [inlined]
 [2] eval at /home/fredrikb/julia/usr/share/julia/stdlib/v1.5/Markdown/src/Markdown.jl:6 [inlined]
 [3] __init__() at /home/fredrikb/.julia/packages/Weave/AL87K/src/WeaveMarkdown/markdown.jl:10
nickrobinson251 commented 4 years ago

384