# Error building packages when startup file is used (v1.0)

**URL:** <https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318>\
**Category:** General Usage\
**Created:** [August 30, 2018, 1:37pm UTC](https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318 "2018-08-30T13:37:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcreel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcreel/32/30088_2.png) [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Post date:** [August 30, 2018, 1:37pm UTC](https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318/1 "2018-08-30T13:37:19Z")

</div>

With v1.0, I find that I get errors building Plots or NLopt when I start julia with a ./.julia/config/startup.jl file that contains `using Revise`, and/or `using OhMyREPL` but if I start without the startup file, the packages build normally.

With the startup file containing `using Revise`, the error is below. With `using OhMyREPL`, a similar error occurs. This is reproducible. I’m not sure where to report this, if it’s a bug. Perhaps I’m doing something wrong.

```julia
(v1.0) pkg> build Plots
  Building GR ───→ `~/.julia/packages/GR/fnyt8/deps/build.log`
┌ Error: Error building `GR`: 
│ ERROR: LoadError: ArgumentError: Package Revise not found in current path:
│ - Run `Pkg.add("Revise")` to install the Revise package.
│ 
│ Stacktrace:
│ [1] require(::Module, ::Symbol) at ./loading.jl:817
│ [2] include at ./boot.jl:317 [inlined]
│ [3] include_relative(::Module, ::String) at ./loading.jl:1038
│ [4] include at ./sysimg.jl:29 [inlined]
│ [5] include_ifexists at ./client.jl:191 [inlined]
│ [6] load_julia_startup() at ./client.jl:288
│ [7] exec_options(::Base.JLOptions) at ./logging.jl:312
│ [8] _start() at ./client.jl:421
│ in expression starting at /home/michael/.julia/config/startup.jl:1
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1068
  Building Plots → `~/.julia/packages/Plots/MnXMC/deps/build.log`
┌ Error: Error building `Plots`: 
│ ERROR: LoadError: ArgumentError: Package Revise not found in current path:
│ - Run `Pkg.add("Revise")` to install the Revise package.
│ 
│ Stacktrace:
│ [1] require(::Module, ::Symbol) at ./loading.jl:817
│ [2] include at ./boot.jl:317 [inlined]
│ [3] include_relative(::Module, ::String) at ./loading.jl:1038
│ [4] include at ./sysimg.jl:29 [inlined]
│ [5] include_ifexists at ./client.jl:191 [inlined]
│ [6] load_julia_startup() at ./client.jl:288
│ [7] exec_options(::Base.JLOptions) at ./logging.jl:312
│ [8] _start() at ./client.jl:421
│ in expression starting at /home/michael/.julia/config/startup.jl:1
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1068

(v1.0) pkg>

```

---

<div class="post-metadata">

**Author:** ![swt30](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swt30/32/4667_2.png) [@swt30](https://discourse.julialang.org/u/swt30)\
**Post date:** [August 30, 2018, 1:44pm UTC](https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318/2 "2018-08-30T13:44:41Z")

</div>

> [@Error with Pkg with using statement in startup.jl](https://discourse.julialang.org/t/error-with-pkg-with-using-statement-in-startup-jl/13127):
>
> I have a using statement in my startup.jl file (using OhMyREPL), and upon building packages, I get the following warnings Building LibCURL ─→ `C:\Users\Jeremy\.julia\packages\LibCURL\yT2TD\deps\build.log` ┌ Error: Error building `LibCURL`: │ ERROR: LoadError: ArgumentError: Package OhMyREPL not found in current path: │ - Run `Pkg.add("OhMyREPL")` to install the OhMyREPL package. │ │ Stacktrace: │ [1] require(::Module, ::Symbol) at .\loading.jl:817 │ [2] include at .\boot.jl:317 [inlined] │ …

> <https://github.com/JuliaLang/Pkg.jl/issues/609>
>
> In Julia 1.0.0, every time I try to build a package, the startup script \`~/.juli…a/config/startup.jl\` is called. If that script imports any package not available in the build environment, the build fails. For instance, if I add \`using OhMyREPL\` to my \`startup.jl\`, the build fails with this error:
> 
> \`\`\`julia-repl
> julia\> Pkg.add("Plots")
> Updating registry at \`~/.julia/registries/General\`
> Updating git-repo \`https://github.com/JuliaRegistries/General.git\`
> Resolving package versions...
> Installed Showoff ────── v0.2.0
> Installed StaticArrays ─ v0.8.3
> Installed Plots ──────── v0.18.0
> Installed PlotUtils ──── v0.5.0
> Installed PlotThemes ─── v0.3.0
> Installed Measures ───── v0.2.0
> Installed RecipesBase ── v0.4.0
> Installed Contour ────── v0.5.0
> Installed GR ─────────── v0.32.2
> Updating \`~/.julia/environments/v1.0/Project.toml\`
> \[91a5bcdd\] + Plots v0.18.0
> Updating \`~/.julia/environments/v1.0/Manifest.toml\`
> \[d38c429a\] + Contour v0.5.0
> \[28b8d3ca\] + GR v0.32.2
> \[442fdcdd\] + Measures v0.2.0
> \[ccf2f8ad\] + PlotThemes v0.3.0
> \[995b91a9\] + PlotUtils v0.5.0
> \[91a5bcdd\] + Plots v0.18.0
> \[3cdcf5f2\] + RecipesBase v0.4.0
> \[992d4aef\] + Showoff v0.2.0
> \[90137ffa\] + StaticArrays v0.8.3
> Building GR ───→ \`~/.julia/packages/GR/crXzk/deps/build.log\`
> ┌ Error: Error building \`GR\`:
> │ ERROR: LoadError: ArgumentError: Package OhMyREPL not found in current path:
> │ - Run \`Pkg.add("OhMyREPL")\` to install the OhMyREPL package.
> ....
> \`\`\`
> 
> I think building a package should not call the \`startup.jl\` at all, and it should try to build the packages in a "clean" environment.
> 
> My versioninfo:
> 
> \`\`\`
> Julia Version 1.0.0
> Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
> Platform Info:
> OS: macOS (x86\_64-apple-darwin14.5.0)
> CPU: Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
> WORD\_SIZE: 64
> LIBM: libopenlibm
> LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
> \`\`\`
> 
> PS: Also reported here, to try to find a way not to import \`OhMyREPL\` when the session is not interactive: https://github.com/KristofferC/OhMyREPL.jl/issues/68

Looks like this will be fixed in the next Julia release v1.0.1.

---

<div class="post-metadata">

**Author:** ![swt30](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swt30/32/4667_2.png) [@swt30](https://discourse.julialang.org/u/swt30)\
**Post date:** [September 4, 2018, 10:39am UTC](https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318/3 "2018-09-04T10:39:00Z")

</div>

Oh and I forgot to say, in the meantime you can wrap your startup file statements in a try … catch. Then the build step should still run. My startup.jl looks like this:

```nohighlight
# OhMyREPL
try
    @eval using OhMyREPL
    OhMyREPL.colorscheme!("TomorrowNightBright24bit")
    OhMyREPL.enable_autocomplete_brackets(false)
catch err
    @warn "OhMyREPL could not be started" err
end

# Revise
try
    @eval using Revise
    Revise.async_steal_repl_backend()
catch err
    @warn "Revise could not be started" err
end

```

---

<div class="post-metadata">

**Author:** ![mcreel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcreel/32/30088_2.png) [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Post date:** [September 4, 2018, 10:47am UTC](https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318/4 "2018-09-04T10:47:25Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![charleshuett](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charleshuett/32/22230_2.png) [@charleshuett](https://discourse.julialang.org/u/charleshuett)\
**Post date:** [February 26, 2021, 3:31pm UTC](https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318/5 "2021-02-26T15:31:58Z")

</div>

Brillant! thank you very much for your insight and code snippets
