# Error: failed to evaluate \`Modules =

**URL:** <https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583>\
**Category:** General Usage\
**Tags:** documenter\
**Created:** [April 28, 2024, 11:45am UTC](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583 "2024-04-28T11:45:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [April 28, 2024, 11:45am UTC](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583/1 "2024-04-28T11:45:32Z")

</div>

I have a docs page with this autodocs field (without the comments):

````julia
#```@autodocs
Modules = [MolSimToolkit.Reweighting]
Pages = ["Reweighting/reweighting.jl"]
Order = [:function, :type]
#```

````

The module `Reweighting` is in the file `/src/Reweighting/reweighthing.jl`.

This autodocs fais with:

````julia
┌ Error: failed to evaluate `Modules = [MolSimToolkit.Reweighting]` in `@autodocs` block in src/Reweighting.md:111-115
│ ```@autodocs
│ Modules = [MolSimToolkit.Reweighting]
│ Pages = ["Reweighting/reweighting.jl"]
│ Order = [:function, :type]
│ ```
│ exception = UndefVarError: `Reweighting` not defined
└ @ Documenter ~/.julia/packages/Documenter/pA5Sa/src/utilities/utilities.jl:44
┌ Error: '@autodocs' missing 'Modules = ...' in src/Reweighting.md:111-115
│ ```@autodocs
│ Modules = [MolSimToolkit.Reweighting]
│ Pages = ["Reweighting/reweighting.jl"]
│ Order = [:function, :type]
│ ```
└ @ Documenter ~/.julia/packages/Documenter/pA5Sa/src/utilities/utilities.jl:44
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
ERROR: `makedocs` encountered an error [:autodocs_block] -- terminating build before rendering.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] runner(::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Document)
   @ Documenter ~/.julia/packages/Documenter/pA5Sa/src/builder_pipeline.jl:253
 [3] dispatch(::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Document)
   @ Documenter.Selectors ~/.julia/packages/Documenter/pA5Sa/src/utilities/Selectors.jl:170
 [4] #84
   @ ~/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:248 [inlined]
 [5] withenv(::Documenter.var"#84#86"{Documenter.Document}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
   @ Base ./env.jl:257
 [6] #83
   @ ~/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:247 [inlined]
 [7] cd(f::Documenter.var"#83#85"{Documenter.Document}, dir::String)
   @ Base.Filesystem ./file.jl:112
 [8] #makedocs#82
   @ ~/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:247 [inlined]
 [9] top-level scope
   @ ~/Downloads/MolSimToolkit.jl/docs/make.jl:7

````

I tried changing the path of the files, the names, but for now without success. In the same project I have some other similar structures which do work.

Any ideas?

In any case, to reproduce it:

```julia
git clone https://github.com/LV-IQ/MolSimToolkit.jl
cd MolSimToolkit.jl
julia --project
] activate docs
instantiate
using LiveServer
servedocs()

```

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [April 28, 2024, 12:02pm UTC](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583/2 "2024-04-28T12:02:48Z")

</div>

I think I found what may be the issue, but it is more related to how to develop packages in general:

This is a fork of the original package. But in the `docs` we have `Project.toml` that points to `dev MolSimToolkit`.

Then, the `docs` project loads the `.julia/dev/MolSimToolkit.jl` version, which is not the version of the package that has to be loaded here, which is the one on the top folder of the _current_ git fork (`../MolSimToolkit`).

How can I make the `Project.toml` project point to the _current local_ directory of the main package, so that `instantiate` the `docs` project uses the current version instead of a `dev`d version of the main package?

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [April 28, 2024, 12:15pm UTC](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583/3 "2024-04-28T12:15:57Z")

</div>

Ok, this can be solved by:

```julia
docs> rm MolSimToolkit

docs> add "../MolSimToolkit.jl"

```

which is slightly annoying because when one does `dev MolSimToolkit` the directory does not carry the `.jl`, such that ~~we need to have different `Project.toml` files for the `docs` project in a fork relative to the main package.~~

edit: actually different `Manifest.toml` files, but I’m not even uploading them. So I don’t see a solution really, except dealing locally with these differences…

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [April 28, 2024, 12:56pm UTC](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583/4 "2024-04-28T12:56:13Z")

</div>

You actually can do something like “take the parents folder under development”, see [Manopt.jl/docs/make.jl at 77c672042d41657af9d8d95e37bc972acd96ed70 · JuliaManifolds/Manopt.jl · GitHub](https://github.com/JuliaManifolds/Manopt.jl/blob/77c672042d41657af9d8d95e37bc972acd96ed70/docs/make.jl#L37)

this and the following resolve should make it work just fine, I think.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [April 28, 2024, 1:48pm UTC](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583/5 "2024-04-28T13:48:53Z")

</div>

Won’t that interfere with the deployment of the stable docs?

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [April 28, 2024, 2:23pm UTC](https://discourse.julialang.org/t/error-failed-to-evaluate-modules/113583/6 "2024-04-28T14:23:19Z")

</div>

I did not think so, but indeed, if you are fast enough, it might, Running this on main after registration might pick a newer version if between staring the registration and the tag run you manage to commit to main.
