# Reverting back to avoid precompile errors?

**URL:** <https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 30, 2021, 1:48pm UTC](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354 "2021-08-30T13:48:07Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [September 1, 2021, 9:07am UTC](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354/21 "2021-09-01T09:07:30Z")

</div>

To be clear, the problem here is as follows:

1. Julia is started and some packages are imported as part of an editing environment (e.g. IJulia, Atom etc.) or from the startup file. These imports happen in some (Julia) environment (possibly the default) with its set of package versions for direct and indirect dependencies.
2. A _different_ environment is activated. This might have different package versions in its manifest than the first environment had because the compat requirements makes it necessary to resolve to a different set of versions.
3. Some package is imported in the new environment. In case this package or one of its dependencies was already loaded in step 1, that will be reused since Julia can only have one version of a given package loaded in the same process. However, if that was of a different version than we wanted to load this time, we won’t have the code we intended and if there were breaking changes between the versions things might, well, break.

> [@magister-ludi](#):
>
> It might be that other packages that require some sort of parsing produce similar results ( `Revise` is one I thought could be a problem, but it isn’t).

Actually `Revise` has very few non-stdlib indirect dependencies but if `Requires` or `OrderedCollections` ever get breaking updates, things might get ugly.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 1, 2021, 9:20am UTC](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354/22 "2021-09-01T09:20:28Z")

</div>

> [@magister-ludi](#):
>
> Then I did a series of runs, repeating what I had just done, but adding one of the packages I usually load in my startup before `activate` / `add` / `using` . Everything ran smoothly until I added `JuliaFormatter` first. **Then** I had the compilation error.

There’s the problem then:

```julia
(@v1.7) pkg> activate --temp                
  Activating new project at `/tmp/jl_R7mGad`

(jl_R7mGad) pkg> add JuliaFormatter                                   
    Updating registry at `~/.julia/registries/General`                
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...                                      
    Updating `/tmp/jl_R7mGad/Project.toml`                            
  [98e50ef6] + JuliaFormatter v0.15.10                                
    Updating `/tmp/jl_R7mGad/Manifest.toml`                           
...

julia> using JuliaFormatter                                                                       
[Info: Precompiling JuliaFormatter [98e50ef6-434e-11e9-1051-2b60c6c9e899]                        
                                                                                                  
(jl_R7mGad) pkg> add CSV                                                                          
   Resolving package versions...                                                                  
    Updating `/tmp/jl_R7mGad/Project.toml`                                                        
  [336ed68f] + CSV v0.8.5                                                                         
    Updating `/tmp/jl_R7mGad/Manifest.toml`                                                       
  [336ed68f] + CSV v0.8.5                                                                         
  [9a962f9c] + DataAPI v1.7.0                                                                     
  [e2d170a0] + DataValueInterfaces v1.0.0                                                         
  [82899510] + IteratorInterfaceExtensions v1.0.0                                                 
  [69de0a69] ↓ Parsers v2.0.3 ⇒ v1.1.2 # note `Parsers` being downgraded a major version!
  [2dfb63ee] + PooledArrays v1.3.0                                                                
  [91c51154] + SentinelArrays v1.3.7                                                              
  [3783bdb8] + TableTraits v1.0.1                                                                 
  [bd369af6] + Tables v1.5.0                                                                      
  [9fa8497b] + Future                                                                             
Precompiling project...                                                                           
  1 dependency successfully precompiled in 8 seconds (24 already precompiled)                     
                                                                                                  
(jl_R7mGad) pkg> st                                                                               
      Status `/tmp/jl_R7mGad/Project.toml`                                                        
  [336ed68f] CSV v0.8.5                                                                           
  [98e50ef6] JuliaFormatter v0.15.10                                                              
                                                                                                  
julia> using CSV                                                                                  
[Info: Precompiling CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b]                                   
ERROR: LoadError: TypeError: in Type{...} expression, expected UnionAll, got Type{Parsers.Options}

```

The `using JuliaFormatter` step at the start is crucial. Since `JuliaFormatter` depends on `CommonMark`, which depends on `JSON` which claims to be and truly is compatible with `Parsers` versions 1 and 2, I’m not sure where to lay blame here. Truthfully, `JuliaFormatters` and `Parsers` should have to be recompiled once `Parsers` was downgraded or `CSV` should see a different `Parsers` to `JuliaFormatter` (which is stated non-policy, as far as I remember).

Is there documentation/precedent for how this is handled?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [September 1, 2021, 10:49am UTC](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354/23 "2021-09-01T10:49:13Z")

</div>

> [@Sukera](#):
>
> Is there documentation/precedent for how this is handled?

There’s a related issue at least: [Warn when a package loads a dependencies that already got loaded and that dependency has a different version than in the current manifest. · Issue #32906 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/32906)

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 1, 2021, 10:55am UTC](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354/24 "2021-09-01T10:55:14Z")

</div>

Nice, I’ll crosslink this thread to github so we have an example “out in the wild” - thanks for finding that issue!

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 1, 2021, 11:18am UTC](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354/25 "2021-09-01T11:18:00Z")

</div>

Dear All, I can’t understand any of this… I just can’t load CSV. I don’t need/want to know why it is failing, but I will not be able to use Julia until this is fixed and I can run

```julia
]add CSV
using CSV

```

Does anyone have any idea when that might be?

Thanks

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [September 1, 2021, 11:52am UTC](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354/26 "2021-09-01T11:52:23Z")

</div>

Impossible to say without knowing more details but you can try it from the Julia REPL after starting Julia with `julia --startup-file=no`.

---

<div class="post-metadata">

**Author:** ![martin.demare](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/martin.demare/32/25222_2.png) [@martin.demare](https://discourse.julialang.org/u/martin.demare)\
**Post date:** [September 1, 2021, 12:30pm UTC](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354/27 "2021-09-01T12:30:27Z")

</div>

The solution suggested by @GunnarFarneback is more general, however a very Atom-specific work-around is to add CSV to the base environment and then restarting Atom. The dependencies of CSV are then incorporated early enough in the initiation process not to cause problems. After that it works fine to activate other environments and adding CSV to them as needed.

[Previous page](https://discourse.julialang.org/t/reverting-back-to-avoid-precompile-errors/67354.md?page=1)
