# Building documentation on travis via Documenter: can't find the installed packages

**URL:** <https://discourse.julialang.org/t/building-documentation-on-travis-via-documenter-cant-find-the-installed-packages/12763>\
**Category:** General Usage\
**Tags:** package\
**Created:** [July 31, 2018, 10:52am UTC](https://discourse.julialang.org/t/building-documentation-on-travis-via-documenter-cant-find-the-installed-packages/12763 "2018-07-31T10:52:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 31, 2018, 10:52am UTC](https://discourse.julialang.org/t/building-documentation-on-travis-via-documenter-cant-find-the-installed-packages/12763/1 "2018-07-31T10:52:08Z")

</div>

I would very much so appreciate some help with building documentation on Travis. I have this package which the only thing it does is host the documentation: [https://github.com/JuliaMusic/JuliaMusic\_documentation.jl](https://github.com/JuliaMusic/JuliaMusic_documentation.jl)

with source

```julia
module JuliaMusic_documentation

using Reexport
@reexport using MIDI, MotifSequenceGenerator, MusicManipulations

end

```

(all the above packages are in the `REQUIRE`).

My travis build is trivial, it has no “script”, (uses the default) and after that I have

```julia
after_success:
  - julia -e 'Pkg.add("Documenter"); Pkg.add("Literate")'
  - julia -e 'cd(Pkg.dir("JuliaMusic_documentation")); include(joinpath("docs", "make.jl"))'

```

My `make.jl` is

```julia
using JuliaMusic_documentation

using Documenter, Literate

docdir = @ __DIR__
docdir *= "/src/"

tobe = ["motif/musicexample.jl"]

for file in tobe
    f = docdir*file
    Literate.markdown(f, dirname(f))
end

makedocs(modules=[JuliaMusic_documentation], doctest=false)

#%% Deploy

deploydocs(
    deps = Deps.pip("Tornado>=4.0.0,<5.0.0", "mkdocs",
    "mkdocs-material" ,"python-markdown-math", "pygments", "pymdown-extensions"),
    repo = "github.com/JuliaMusic/JuliaMusic_documentation.jl.git",
    julia = "nightly",
    osname = "linux"
)

```

Here is the problem: When I run on travis, it tells me that when documeter runs, it can’t find the packages `MIDI, MusicManipulations`, etc. I don’t know why!

```julia
WARNING: importing deprecated binding Base.gamma into Combinatorics.
Documenter: setting up build directory.
Documenter: expanding markdown templates.
 !! failed to run code block.
ArgumentError("Package MusicManipulations not found in current path:\n- Run `Pkg.add(\"MusicManipulations\")` to install the MusicManipulations package.\n") [src/mm/quantizing.md]
 !! failed to run code block.
ArgumentError("Package MIDI not found in current path:\n- Run `Pkg.add(\"MIDI\")` to install the MIDI package.\n") [src/midi/notes.md]
 !! failed to run code block.
UndefVarError(:midi) [src/midi/notes.md]
 !! failed to run code block.

```

The travis fail is here: [Travis CI - Test and Deploy Your Code with Confidence](https://travis-ci.org/JuliaMusic/JuliaMusic_documentation.jl/jobs/410264018#L584)

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [July 31, 2018, 11:02am UTC](https://discourse.julialang.org/t/building-documentation-on-travis-via-documenter-cant-find-the-installed-packages/12763/2 "2018-07-31T11:02:29Z")

</div>

Changing my Travis.yml to

```julia
after_success:
  - julia -e 'Pkg.add("Documenter"); Pkg.add("Literate")'
  - julia -e 'Pkg.add("MIDI"); Pkg.add("MotifSequenceGenerator"); Pkg.add("MusicManipulations")'
  - julia -e 'cd(Pkg.dir("JuliaMusic_documentation")); include(joinpath("docs", "make.jl"))'

```

solved the problem. But why? It seems that I lack fundamental understanding of the new package system.

Since my REQUIRE has

```julia
julia 0.7-beta2
Reexport
MIDI 0.8
MotifSequenceGenerator 0.1
MusicManipulations 0.1

```

and since the module `JuliaMusic_documentation` does

```julia
module JuliaMusic_documentation

using Reexport
@reexport using MIDI, MotifSequenceGenerator, MusicManipulations

end

```

Shouldn’t the moment I do `using JuliaMusic_documentation` have access to all names from e.g. `MIDI`, including `MIDI` itself? Why is `Documenter` complaining?

---

<div class="post-metadata">

**Author:** ![mortenpi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mortenpi/32/158_2.png) [@mortenpi](https://discourse.julialang.org/u/mortenpi)\
**Post date:** [July 31, 2018, 11:38am UTC](https://discourse.julialang.org/t/building-documentation-on-travis-via-documenter-cant-find-the-installed-packages/12763/3 "2018-07-31T11:38:04Z")

</div>

The problem is that you’re importing package dependencies in the `@example` blocks (e.g. `using MusicManipulations` in `src/mm/quantizing.md`). When building docs on 0.7, if you need to do a `import`/`using` on a package dependency directly, you first need to `pkg add` them explicitly, as if they are an external dependency (just like you would in the REPL).

So I think the best course of action would be to add all the dependencies you use directly in the docs as `Pkg.add()`s in the `after_success` part.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [July 31, 2018, 12:13pm UTC](https://discourse.julialang.org/t/building-documentation-on-travis-via-documenter-cant-find-the-installed-packages/12763/4 "2018-07-31T12:13:07Z")

</div>

Or later, when the Project.toml story is finished, you would not need to `add` but just have them in the project file.
