# Error precompiling Plots: RecipesBase.jl:607 needs to be placed at the top level, or use "eval"

**URL:** https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694
**Category:** General Usage
**Created:** [December 15, 2022, 11:15am UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694 "2022-12-15T11:15:00Z")
**Posts on this page:** 8
**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: [December 15, 2022, 11:15am UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694/1 "2022-12-15T11:15:00Z")

</div>

Any hint on how to solve this precompilation problem? I’m using an environment and all the packages seem up to date.

```julia
precompile
Precompiling project...
  ✗ Plots
  0 dependencies successfully precompiled in 2 seconds. 180 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/leandro/.julia/compiled/v1.8/Plots/jl_YLLoQ5.
ERROR: LoadError: syntax: Global method definition around /home/leandro/.julia/packages/RecipesBase/eU0hg/src/RecipesBase.jl:607 needs to be placed at the top level, or use "eval".
Stacktrace:
 [1] top-level scope
   @ ~/.julia/packages/RecipesBase/eU0hg/src/RecipesBase.jl:600
 [2] include
   @ ./Base.jl:419 [inlined]
 [3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
   @ Base ./loading.jl:1554
 [4] top-level scope
   @ stdin:1
in expression starting at /home/leandro/.julia/packages/RecipesBase/eU0hg/src/RecipesBase.jl:1
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile RecipesBase [3cdcf5f2-1ef4-517c-9805-6587b60abb01] to /home/leandro/.julia/compiled/v1.8/RecipesBase/jl_3UMlMP.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:1707
  [3] compilecache
    @ ./loading.jl:1651 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [6] macro expansion
    @ ./loading.jl:1180 [inlined]
  [7] macro expansion
    @ ./lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
  [9] include
    @ ./Base.jl:419 [inlined]
 [10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1554
 [11] top-level scope
    @ stdin:1
in expression starting at /home/leandro/.julia/packages/Plots/Hxe7H/src/Plots.jl:1

```

edit: the issue got solved. After `using Plots`, I got a warning saying that GR was not installed, then it installed it and now everything is working. I don’t know why before the dependency was not there.

---

<div class="post-metadata">

### Author: ![j-fu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j-fu/32/11373_2.png) [@j-fu](https://discourse.julialang.org/u/j-fu)
#### Post date: [December 15, 2022, 11:53am UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694/2 "2022-12-15T11:53:02Z")

</div>

I am suddenly getting the same error on CI.  
I am getting this as well when installing RecipesBase as the only package in a clean environment. IMHO installation of GR shouldn’t be required to make this work.

---

<div class="post-metadata">

### Author: ![j-fu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j-fu/32/11373_2.png) [@j-fu](https://discourse.julialang.org/u/j-fu)
#### Post date: [December 15, 2022, 11:55am UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694/3 "2022-12-15T11:55:19Z")

</div>

See [[BUG] RecipesBase and RecipesPipeline fail to precompile · Issue #4597 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/issues/4597)

---

<div class="post-metadata">

### Author: ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)
#### Post date: [December 15, 2022, 12:05pm UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694/4 "2022-12-15T12:05:09Z")

</div>

Look like induced by latest `SnoopPrecompile` [latest version of `SnoopPrecompile` breaks `RecipesBase` · Issue #317 · timholy/SnoopCompile.jl · GitHub](https://github.com/timholy/SnoopCompile.jl/issues/317).

I think we should yank `SnoopPrecompile@1.0.2` until we know more, since this affects a lots of `Plots` users.

cc @tim.holy

---

<div class="post-metadata">

### Author: ![iago-lito](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iago-lito/32/31924_2.png) [@iago-lito](https://discourse.julialang.org/u/iago-lito)
#### Post date: [December 15, 2022, 12:27pm UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694/5 "2022-12-15T12:27:07Z")

</div>

`DifferentialEquations` also seems affected. Thanks for the diagnosis and the quickfix \<3

---

<div class="post-metadata">

### Author: ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)
#### Post date: [December 15, 2022, 12:30pm UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694/6 "2022-12-15T12:30:56Z")

</div>

```julia
pkg> update

```

should fix this issue, since `SnoopPrecompile@1.0.2` was yanked.

Check with `] status -m SnoopPrecompile`, that you **don’t** have `1.0.2`.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [December 15, 2022, 12:31pm UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694/7 "2022-12-15T12:31:22Z")

</div>

Yeah I saw it, and then the Plots.jl issue with 20 people saying “same” within the last hour, so I merged the yank.

> <https://github.com/JuliaRegistries/General/pull/74176>
>
> https://github.com/JuliaPlots/Plots.jl/issues/4597
> https://discourse.julialang.…org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694
> https://github.com/timholy/SnoopCompile.jl/issues/317

Usually one doesn’t merge a yank until the maintainer agrees, but this seems like a special scenario that was going to effect half of Julia users, so might as well do it before the well-adjusted humans of the US east coast wake up. @tim.holy let me know if you want it back, but I assume you’re okay with a quick action here.

---

<div class="post-metadata">

### Author: ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)
#### Post date: [December 15, 2022, 12:56pm UTC](https://discourse.julialang.org/t/error-precompiling-plots-recipesbase-jl-607-needs-to-be-placed-at-the-top-level-or-use-eval/91694/8 "2022-12-15T12:56:22Z")

</div>

Definitely OK with it, sorry this happened. We need a test case to catch this.
