JuliaIntervals / IntervalLinearAlgebra.jl

Linear algebra done rigorously
MIT License
36 stars 9 forks source link

[bug] generation of documentation freezes #120

Closed jorgepz closed 2 years ago

jorgepz commented 2 years ago

Bug description

the process of generation of the documentation freezes in ubuntu and in arch. the build folder is not filled with the files. only image files are copied to assets and applications folder

Minimum (non-)working example

(@v1.7) pkg> activate .
  Activating project at `~/work/IntervalLinearAlgebra.jl`

julia> include("docs/make.jl")
[ Info: generating markdown page from `~/work/IntervalLinearAlgebra.jl/docs/literate/applications/FEM_example.jl`
[ Info: writing result to `~/work/IntervalLinearAlgebra.jl/docs/src/applications/FEM_example.md`
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.

Expected behavior

documentation html files generated in the build folder.

Version info

(IntervalLinearAlgebra) pkg> st
     Project IntervalLinearAlgebra v0.1.4
      Status `~/work/IntervalLinearAlgebra.jl/Project.toml`
  [38540f10] CommonSolve v0.2.0
  [d1acc4aa] IntervalArithmetic v0.20.3
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [90137ffa] StaticArrays v1.3.3
  [37e2e46d] LinearAlgebra
julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
lucaferranti commented 2 years ago

I cannot reproduce this, it works fine for me (tested on windows and ubuntu. You are calling include("docs/make.jl"). By the printed log, it seems you have Documenter and Literate installed in your main environment, so that's probably not the problem.

What version of Documenter are you using? Was the problem that the generated build folder is empty or that it takes forever and never generates it? If it's the former, it almost sounds like Documenter doesn't have the rights to write in that folder šŸ¤” are you using your own computer or some university computer in the university network?

jorgepz commented 2 years ago

The versions of what is installed in the main environment are

(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [e30172f5] Documenter v0.27.12
  [b4f0291d] LazySets v1.53.4
  [98b081ad] Literate v2.10.0
  [91a5bcdd] Plots v1.25.6
  [56ddb016] Logging

the folder structure of the build folder is generated buy only svg and png images are copied there....

jorge@iet47:~/work/IntervalLinearAlgebra.jl$ ls docs/build/
api  applications  assets  explanations  tutorials
jorge@iet47:~/work/IntervalLinearAlgebra.jl$ ls docs/build/api/
jorge@iet47:~/work/IntervalLinearAlgebra.jl$ ls docs/build/assets/
3dexample.png  logo.svg  logo-text.svg  quickstart.png  trussDiagram.svg
jorge@iet47:~/work/IntervalLinearAlgebra.jl$ ls docs/build/applications/
deformed.png
jorge@iet47:~/work/IntervalLinearAlgebra.jl$ ls docs/build/explanations/
jorge@iet47:~/work/IntervalLinearAlgebra.jl$ ls docs/build/tutorials/
jorge@iet47:~/work/IntervalLinearAlgebra.jl$ 

I tested in Windows 10 and was able to generate the docs!

I have admin privileges in the computers I am using.

I think that the debugger might help... i made an execution using some commands from https://docs.julialang.org/en/v1/stdlib/Logging/ this is the output (sorry for the extension šŸ˜… )

(@v1.7) pkg> activate .
  Activating project at `~/work/IntervalLinearAlgebra.jl`

(IntervalLinearAlgebra) pkg> instantiate

julia> using Logging

julia> debuglogger = ConsoleLogger(stderr, Logging.Debug)
ConsoleLogger(Base.TTY(RawFD(15) open, 0 bytes waiting), Debug, Logging.default_metafmt, true, 0, Dict{Any, Int64}())

julia> with_logger(debuglogger) do
                  @debug include("docs/make.jl")
           end
ā”Œ Debug: GR Binaries:
ā”‚   GR.gr_provider[] = "BinaryBuilder"
ā”‚   GR.libGR = "libGR.so"
ā”‚   GR.libGR3 = "libGR3.so"
ā”‚   GR.libGRM = "libGRM.so"
ā”” @ GR ~/.julia/packages/GR/KPElO/src/GR.jl:322
[ Info: generating markdown page from `~/work/IntervalLinearAlgebra.jl/docs/literate/applications/FEM_example.jl`
[ Info: writing result to `~/work/IntervalLinearAlgebra.jl/docs/src/applications/FEM_example.md`
ā”Œ Debug: Creating documentation metadata dictionary (META=##docmeta#274) in IntervalLinearAlgebra
ā”” @ Documenter.DocMeta ~/.julia/packages/Documenter/Nu7Lp/src/DocMeta.jl:36
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
ā”Œ Debug: Running doctests.
ā”” @ Documenter.DocTests ~/.julia/packages/Documenter/Nu7Lp/src/DocTests.jl:47
[ Info: ExpandTemplates: expanding markdown templates.
ā”Œ Debug: pages
ā”‚   keys(doc.blueprint.pages) =
ā”‚    KeySet for a Dict{String, Documenter.Documents.Page} with 15 entries. Keys:
ā”‚      "references.md"
ā”‚      "api/eigenvalues.md"
ā”‚      "api/precondition.md"
ā”‚      "applications/FEM_example.md"
ā”‚      "explanations/preconditioning.md"
ā”‚      "CONTRIBUTING.md"
ā”‚      "tutorials/linear_systems.md"
ā”‚      "api/misc.md"
ā”‚      ā‹®
ā”‚   priority_pages = String[]
ā”‚   normal_pages =
ā”‚    15-element Vector{String}:
ā”‚     "CONTRIBUTING.md"
ā”‚     "api/algorithms.md"
ā”‚     "api/classify.md"
ā”‚     "api/eigenvalues.md"
ā”‚     ā‹®
ā”‚     "index.md"
ā”‚     "references.md"
ā”‚     "tutorials/eigenvalues.md"
ā”‚     "tutorials/linear_systems.md"
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:36
ā”Œ Debug: Running ExpanderPipeline on CONTRIBUTING.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Running ExpanderPipeline on api/algorithms.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Evaluating @docs block:
ā”‚ GaussianElimination
ā”‚ HansenBliekRohn
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:279
ā”Œ Debug: Evaluating @docs block:
ā”‚ GaussSeidel
ā”‚ Jacobi
ā”‚ LinearKrawczyk
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:279
ā”Œ Debug: Evaluating @docs block:
ā”‚ LinearOettliPrager
ā”‚ NonLinearOettliPrager
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:279
ā”Œ Debug: Evaluating @docs block:
ā”‚ Skalna06
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:279
ā”Œ Debug: Running ExpanderPipeline on api/classify.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Evaluating @autodocs block:
ā”‚ Modules=[IntervalLinearAlgebra]
ā”‚ Pages = ["classify.jl"]
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:376
ā”Œ Debug: Running ExpanderPipeline on api/eigenvalues.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Evaluating @autodocs block:
ā”‚ Modules=[IntervalLinearAlgebra]
ā”‚ Pages=["interval_eigenvalues.jl"]
ā”‚ Private=false
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:376
ā”Œ Debug: Evaluating @autodocs block:
ā”‚ Modules=[IntervalLinearAlgebra]
ā”‚ Pages=["verify_eigs.jl"]
ā”‚ Private=false
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:376
ā”Œ Debug: Running ExpanderPipeline on api/epsilon_inflation.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Evaluating @autodocs block:
ā”‚ Modules = [IntervalLinearAlgebra]
ā”‚ Pages = ["linear_systems/verify.jl"]
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:376
ā”Œ Debug: Running ExpanderPipeline on api/misc.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Evaluating @docs block:
ā”‚ set_multiplication_mode
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:279
ā”Œ Debug: Evaluating @docs block:
ā”‚ @affinevars
ā”‚ AffineExpression
ā”‚ AffineParametricArray
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:279
ā”Œ Debug: Evaluating @autodocs block:
ā”‚ Modules = [IntervalLinearAlgebra]
ā”‚ Pages = ["utils.jl", "rref.jl"]
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:376
ā”Œ Debug: Running ExpanderPipeline on api/precondition.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Evaluating @autodocs block:
ā”‚ Modules=[IntervalLinearAlgebra]
ā”‚ Pages=["precondition.jl"]
ā”‚ Private=false
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:376
ā”Œ Debug: Running ExpanderPipeline on api/solve.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Evaluating @docs block:
ā”‚ solve
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:279
ā”Œ Debug: Running ExpanderPipeline on applications/FEM_example.md
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:39
ā”Œ Debug: Evaluating @meta block:
ā”‚ EditURL = "<unknown>/docs/literate/applications/FEM_example.jl"
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:253
ā”Œ Debug: Evaluating @example block:
ā”‚ function unitaryStiffnessMatrix( coordFirstNode, coordSecondNode  )
ā”‚   diff      = (coordSecondNode - coordFirstNode)
ā”‚   length   = sqrt( diff' * diff )
ā”‚   c        = diff[1] / length
ā”‚   s        = diff[2] / length
ā”‚   Qloc2glo = [ c -s 0 0 ; s c 0 0 ; 0 0 c -s ; 0 0 s c ]
ā”‚   Kloc     = [ 1 0 -1 0 ; 0 0 0 0 ; -1 0 1 0 ; 0 0 0 0 ]
ā”‚   Kglo     = Qloc2glo * Kloc * transpose(Qloc2glo)
ā”‚   return     Kglo, length
ā”‚ end
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
ā”Œ Debug: Evaluating @example block:
ā”‚ E = 2e11 ; # Young modulus
ā”‚ A = 5e-3 ; # Cross-section area
ā”‚ nothing #hide
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
ā”Œ Debug: Evaluating @example block:
ā”‚ nodesCMatrix = [ 0.0 0.0 ;
ā”‚                  1.0 1.0 ;
ā”‚                  2.0 0.0 ;
ā”‚                  3.0 1.0 ;
ā”‚                  4.0 0.0 ];
ā”‚ nothing #hide
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
ā”Œ Debug: Evaluating @example block:
ā”‚ connecMatrix = [ 1     2 ;
ā”‚                  1     3 ;
ā”‚                  2     3 ;
ā”‚                  2     4 ;
ā”‚                  3     4 ;
ā”‚                  3     5 ;
ā”‚                  4     5 ];
ā”‚ nothing #hide
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
ā”Œ Debug: Evaluating @example block:
ā”‚ fixedDofs = [ 2 9 10 ];
ā”‚ nothing #hide
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
ā”Œ Debug: Evaluating @example block:
ā”‚ numNodes = size( nodesCMatrix )[1]  # compute the number of nodes
ā”‚ numElems = size( connecMatrix )[1]  # compute the number of elements
ā”‚ freeDofs = zeros(Int8, 2*numNodes-length(fixedDofs))
ā”‚ indDof  = 1 ; counter = 0
ā”‚ while indDof <= (2*numNodes)
ā”‚   if !(indDof in fixedDofs)
ā”‚     global counter = counter + 1
ā”‚     freeDofs[ counter ] = indDof
ā”‚   end
ā”‚   global indDof = indDof + 1
ā”‚ end
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
ā”Œ Debug: Evaluating @example block:
ā”‚ KG = zeros( 2*numNodes, 2*numNodes )
ā”‚ FG = zeros( 2*numNodes )
ā”‚ for elem in 1:numElems
ā”‚   indexFirstNode  = connecMatrix[ elem, 1 ]
ā”‚   indexSecondNode = connecMatrix[ elem, 2 ]
ā”‚   dofsElem = [2*indexFirstNode-1 2*indexFirstNode 2*indexSecondNode-1 2*indexSecondNode ]
ā”‚   KGelem, lengthElem = unitaryStiffnessMatrix( nodesCMatrix[ indexSecondNode, : ], nodesCMatrix[ indexFirstNode, : ] )
ā”‚   stiffnessParam = E * A / lengthElem
ā”‚   for i in 1:4
ā”‚     for j in 1:4
ā”‚       KG[ dofsElem[i], dofsElem[j] ] = KG[ dofsElem[i], dofsElem[j] ] + stiffnessParam * KGelem[i,j]
ā”‚     end
ā”‚   end
ā”‚ end
ā”‚ FG[4] = -1e4 ;
ā”‚ KG = KG[ freeDofs, : ]
ā”‚ KG = KG[ :, freeDofs ]
ā”‚ FG = FG[ freeDofs ]
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
ā”Œ Debug: Evaluating @example block:
ā”‚ u = KG \ FG
ā”‚ UG = zeros( 2*numNodes )
ā”‚ UG[ freeDofs ] = u
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
ā”Œ Debug: Evaluating @example block:
ā”‚ using Plots
ā”‚ scaleFactor = 2e3
ā”‚ plot();
ā”‚ for elem in 1:numElems
ā”‚   indexFirstNode  = connecMatrix[ elem, 1 ];
ā”‚   indexSecondNode = connecMatrix[ elem, 2 ];
ā”‚   # plot reference element
ā”‚   plot!( nodesCMatrix[ [indexFirstNode, indexSecondNode], 1 ],
ā”‚          nodesCMatrix[ [indexFirstNode, indexSecondNode], 2 ],
ā”‚          linestyle = :dash,  aspect_ratio = :equal,
ā”‚          linecolor = "blue", legend = false)
ā”‚ 
ā”‚   # plot deformed element
ā”‚   plot!( nodesCMatrix[ [indexFirstNode, indexSecondNode], 1 ]
ā”‚            + scaleFactor* [ UG[indexFirstNode*2-1], UG[indexSecondNode*2-1]] ,
ā”‚          nodesCMatrix[ [indexFirstNode, indexSecondNode], 2 ]
ā”‚            + scaleFactor* [ UG[indexFirstNode*2  ], UG[indexSecondNode*2  ]] , markershape = :circle, aspect_ratio = :equal, linecolor = "red",
ā”‚            linewidth=1.5, legend = false )
ā”‚ end
ā”‚ xlabel!("x (m)") # hide
ā”‚ ylabel!("y (m)") # hide
ā”‚ title!( "Deformed with scale factor " * string(scaleFactor) ) # hide
ā”‚ savefig("deformed.png") # hide
ā”” @ Documenter.Expanders ~/.julia/packages/Documenter/Nu7Lp/src/Expanders.jl:566
lucaferranti commented 2 years ago

it seems to me that it generates the docstrings and markdown from literate script successfully? Does it continue?

jorgepz commented 2 years ago

I does not continue... just stays frozen there...

I just tested the generation of ONSAS documentation https://github.com/ONSAS/ONSAS.m/ (using documenter) and it works fine

julia> include("docs/make.jl")
[ Info: Precompiling ONSAS_docs [top-level]
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: HTMLWriter: rendering HTML pages.
ā”Œ Warning: Documenter could not auto-detect the building environment Skipping deployment.
ā”” @ Documenter ~/.julia/packages/Documenter/Nu7Lp/src/deployconfig.jl:75

julia> 
jorgepz commented 2 years ago

it seems to me that it generates the docstrings and markdown from literate script successfully? Does it continue?

yes! the markdown files are generated. they are in the docs/src folder

lucaferranti commented 2 years ago

can you run the FEM_example.jl as a normal julia script, like does that code compile. I am asking because it seems it doesn't generate the images from the second example (the continuous example with 450 nodes)

jorgepz commented 2 years ago

eureka!

I ran the script and got this error

julia> include("docs/literate/applications/FEM_example.jl")
ERROR: LoadError: UndefVarError: @md_str not defined
Stacktrace:
 [1] top-level scope
   @ :0
 [2] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [3] top-level scope
   @ REPL[5]:1
in expression starting at /home/jor/work/jorgepz/IntervalLinearAlgebra.jl/docs/literate/applications/FEM_example.jl:167
in expression starting at /home/jor/work/jorgepz/IntervalLinearAlgebra.jl/docs/literate/applications/FEM_example.jl:167

then removed the md"" comments. ran again the docs/make.jl and it works!

lucaferranti commented 2 years ago

mmm weird, the md""" comments didn't work on Windows but did work on Linux, then I opened this issue and it was fixed after that. Also, I just noticed that you have Literate 2.10, I have 2.9, I'll try to update my literate and see if it breaks the docs. If it does, it's probably a Literate (or Literate+Documenter) issue

lucaferranti commented 2 years ago

yes it works with Literate 2.10 on windows. It also works with Julia 1.6 on WSL, so it might be a julia 1.7 issue or Literate issue

jorgepz commented 2 years ago

Now using Literate 2.11.0 the results are the same in windows and linux. I used the test file from https://github.com/fredrikekre/Literate.jl/issues/171 There is an error when including the script but when using Markdown there are no errors...

julia> using Literate    

julia> include("test_file.jl")
ERROR: LoadError: UndefVarError: @md_str not defined
Stacktrace:
  [1] top-level scope                                                                                                                                                         
    @ :0                                                                                                                                                                      
  [2] include(fname::String)                                                                                                                                               
    @ Base.MainInclude .\client.jl:451                                                                                                                                        
  [3] top-level scope                                                                                                                                                         
    @ REPL[5]:1                                                                                                                                                              
    in expression starting at C:\Users\jor\Desktop\test_file.jl:1                                                                                                          
    in expression starting at C:\Users\jor\Desktop\test_file.jl:1                                                                                                                                                                                                                                                                                 
julia> using Markdown         

julia> include("test_file.jl")     
3                                        
v1.7) pkg> st 
Status `C:\Users\jor\.julia\environments\v1.7\Project.toml` 
[e30172f5] Documenter v0.27.12 
[b4f0291d] LazySets v1.53.4 
[98b081ad] Literate v2.11.0 
[91a5bcdd] Plots v1.25.7 

regarding the documentation generation, now that markdown blocks are defined not using md""" I was able to generate the html both in windows and linux šŸ’Æ