# Mac "Resolving package versions..." takes a long time

**URL:** https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905
**Category:** New to Julia
**Created:** [October 28, 2018, 9:11pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905 "2018-10-28T21:11:19Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![bhalonen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bhalonen/32/9848_2.png) [@bhalonen](https://discourse.julialang.org/u/bhalonen)
#### Post date: [October 28, 2018, 9:11pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/1 "2018-10-28T21:11:19Z")

</div>

I’ve been using Julia for a while, but this has me flummoxed. At work on Arch, a package test spends minimal time in the package resolving stage, but on my Mac it drags.

I have quite a few dependencies, and I would understand it taking a while the first time…

Really a killer on actually doing development when testing takes an eon to just fail.

---

<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: [October 29, 2018, 12:15am UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/2 "2018-10-29T00:15:15Z")

</div>

That is interesting, I have personally never seen it be slow. What time scale are we talking about? What’s the stacktrace from a Ctrl+C? If you copy and paste the environment (Project.toml + Manifest.toml) to another system, is it still slow?

---

<div class="post-metadata">

### Author: ![epogrebnyak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/epogrebnyak/32/6287_2.png) [@epogrebnyak](https://discourse.julialang.org/u/epogrebnyak)
#### Post date: [December 6, 2018, 8:38pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/3 "2018-12-06T20:38:14Z")

</div>

Same with me on Windows - 5-7 sec on a very basic code and simple tests. Ctrl-C does not reveal much:

```julia
(LessOLS) pkg> test
   Testing LessOLS
 Resolving package versions...
ERROR: LoadError: InterruptException:
Stacktrace:
 [1] include(::String) at .\client.jl:392
 [2] top-level scope at none:0
in expression starting at D:\github\LessOLS.jl\test\runtests.jl:2
ERROR: Package LessOLS errored during testing

```

Also when running tests on Travis - it takes about a centrury (\> 1min) to pass after “Resolving package versions” and complete tests at [Travis CI - Test and Deploy Your Code with Confidence](https://travis-ci.org/epogrebnyak/LessOLS.jl)

Cross-posting at [github issues](https://github.com/JuliaLang/julia/issues/30294)

---

<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: [December 6, 2018, 9:06pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/4 "2018-12-06T21:06:48Z")

</div>

For me I get:

```julia
julia> import Pkg

julia> @time Pkg.test("LessOLS")
   Testing LessOLS
 Resolving package versions...
   Testing LessOLS tests passed 
  4.706391 seconds (822.65 k allocations: 47.687 MiB, 0.25% gc time)

```

Note that the code takes quite a lot of time to precompile:

```julia
julia> @time using LessOLS
[Info: Precompiling LessOLS [3e4c6e70-f926-11e8-0fa5-39915c5a2b72]
 39.171277 seconds (2.73 M allocations: 151.785 MiB, 0.40% gc time)

```

which is what Travis has to do before the tests are run. The whole process taking ~50 seconds on the Travis nodes doesn’t seem that odd comparing to the time I get on my laptop.

---

<div class="post-metadata">

### Author: ![epogrebnyak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/epogrebnyak/32/6287_2.png) [@epogrebnyak](https://discourse.julialang.org/u/epogrebnyak)
#### Post date: [December 6, 2018, 9:08pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/5 "2018-12-06T21:08:05Z")

</div>

Why could the precompile be very long? Or perhaps is it too broad question

---

<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: [December 6, 2018, 9:14pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/6 "2018-12-06T21:14:16Z")

</div>

Seems like Distributions is slow to precompile.

```julia
julia> @time using Distributions
[Info: Precompiling Distributions [31c24e10-a181-5473-b8eb-7969acd0382f]
 36.369072 seconds (2.67 M allocations: 148.948 MiB, 0.36% gc time)

```

---

<div class="post-metadata">

### Author: ![epogrebnyak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/epogrebnyak/32/6287_2.png) [@epogrebnyak](https://discourse.julialang.org/u/epogrebnyak)
#### Post date: [December 6, 2018, 9:19pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/7 "2018-12-06T21:19:21Z")

</div>

I cleaned up the compiled cache by deleteing everything at `/.julia /compiled` and compile time reduced, here are times before and after:

```julia
julia> @time using LessOLS
  1.934703 seconds (1.60 M allocations: 95.501 MiB, 2.34% gc time)

julia> @time using LessOLS
  0.001462 seconds (587 allocations: 31.250 KiB)

```

Could it be Travis had Julia installation with precompiled cache? I would expect the oppisite though.

---

<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: [December 6, 2018, 9:23pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/8 "2018-12-06T21:23:09Z")

</div>

I don’t believe those numbers, it should print `[ Info: Precompiling LessOLS`. Did you restart julia in between?

---

<div class="post-metadata">

### Author: ![epogrebnyak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/epogrebnyak/32/6287_2.png) [@epogrebnyak](https://discourse.julialang.org/u/epogrebnyak)
#### Post date: [December 6, 2018, 9:31pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/9 "2018-12-06T21:31:44Z")

</div>

You are right, I did measure without exiting the session. After exiting the session the precompile time is similar to what you have:

```julia
julia> @time using LessOLS
[Info: Precompiling LessOLS [3e4c6e70-f926-11e8-0fa5-39915c5a2b72]
 57.375232 seconds (2.92 M allocations: 159.585 MiB, 0.20% gc time)

```

---

<div class="post-metadata">

### Author: ![epogrebnyak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/epogrebnyak/32/6287_2.png) [@epogrebnyak](https://discourse.julialang.org/u/epogrebnyak)
#### Post date: [December 6, 2018, 9:49pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/10 "2018-12-06T21:49:59Z")

</div>

Most of 57 sec time is precompilation of Distributions:

```julia
julia> @time using Distributions
[Info: Precompiling Distributions [31c24e10-a181-5473-b8eb-7969acd0382f]
 50.983350 seconds (2.91 M allocations: 159.384 MiB, 0.21% gc time)

```

---

<div class="post-metadata">

### Author: ![epogrebnyak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/epogrebnyak/32/6287_2.png) [@epogrebnyak](https://discourse.julialang.org/u/epogrebnyak)
#### Post date: [December 7, 2018, 11:36am UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/11 "2018-12-07T11:36:53Z")

</div>

I wish there was a way around precompiling dependencies for local tests - waiting for cycles of 10s sec on trivial tests is so discouraging for development.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [December 7, 2018, 1:11pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/12 "2018-12-07T13:11:56Z")

</div>

> [@epogrebnyak](#):
>
> I wish there was a way around precompiling dependencies for local tests

You can always just do `include("~/.julia/dev/MyPackage/tests/runtest.jl")` with Revise.jl to avoid recompiling dependencies after every time you change something.

---

<div class="post-metadata">

### Author: ![epogrebnyak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/epogrebnyak/32/6287_2.png) [@epogrebnyak](https://discourse.julialang.org/u/epogrebnyak)
#### Post date: [May 5, 2019, 9:05pm UTC](https://discourse.julialang.org/t/mac-resolving-package-versions-takes-a-long-time/16905/13 "2019-05-05T21:05:56Z")

</div>

Things are much better with `Revise.jl`. On a firest run there is still rather long wait time, of 19 sec, but on the second - the tests run really fast.

```julia
julia> @time include("test/runtests.jl")
 19.758721 seconds (5.05 M allocations: 262.562 MiB, 3.40% gc time)
Test Passed

julia> @time include("test/runtests.jl")
  0.046278 seconds (4.27 k allocations: 224.748 KiB)
Test Passed

```

The 19 seconds are precompilation times for Distributions and Statistics packages, among other things.

```julia
julia> @time using Distributions
  8.965152 seconds (1.59 M allocations: 94.658 MiB, 2.86% gc time)

julia> @time using Statistics
  6.460659 seconds (1.81 M allocations: 84.953 MiB, 1.20% gc time)

```

Not sure what changed from previous versions, but this is much better than 50 seconds for compiling Distributions, as it was before.

One thing that still bothers me: `pkg"test"` will still do all the precompilations and make usual test-driven cycle really impossible due to long wait times. Seems like Revise.jl is a must for TDD in Julia. So why the standard `Pkg.test` is so heavyweight and anyone wanting to do TDD must discover Revise.jl the hard way in Julia? Maybe there can be option to incorporate “test --no-precompile” to Pkg?
