# Feature request: add a reinstall\_all\_packages to Pkg

**URL:** <https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128>\
**Category:** General Usage\
**Created:** [July 26, 2023, 6:31pm UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128 "2023-07-26T18:31:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [July 26, 2023, 6:31pm UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/1 "2023-07-26T18:31:38Z")

</div>

I suggest adding a simple function (`reinstall_all_packages``?) to Pkg that would

- purge all of .julia, except startup.jl and Project.toml (EDIT: plus some dev and Pluto stuff that I forgot about), and
- do an `update`

Motivation: it seems as if I have to do this now and then (more often lately) and I believe this might be daunting for new users. Hence, suggest to add this help function.

---

<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 26, 2023, 9:10pm UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/2 "2023-07-26T21:10:13Z")

</div>

> [@Paul\_Soderlind](#):
>
> it seems as if I have to do this now and then (more often lately)

This seems like it should be investigated further. What problems do you have that this solves?

---

<div class="post-metadata">

**Author:** ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)\
**Post date:** [July 26, 2023, 10:11pm UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/3 "2023-07-26T22:11:13Z")

</div>

I haven’t had to do this myself in some time, but if .julia ends up in a corrupt state during Pkg operations, it’s painful to describe exactly what needs to be nuked to new users (make sure you don’t touch dev/ or pluto\_notebooks/ and probably environments/, but artifacts/, compiled/ and packages/ can go). Yes, Pkg should do things gracefully such that a corrupt state is never attained, but it would still be nice to have a safe-ish reset button for cases of misbehavior.

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [July 27, 2023, 4:23am UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/4 "2023-07-27T04:23:55Z")

</div>

Doesn’t even have to be Pkg misbehaving, could be filesystem corruption for example.

---

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [July 27, 2023, 6:18am UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/5 "2023-07-27T06:18:55Z")

</div>

Symptoms: packages that suddenly fail to build or precompile, with error messages referring to artifacts and caches. Sometimes Conda. Yesterday, a few packages was updated and suddenly a third of all packages (eg. StatsBase) refused to precompile and the error messages pointed towards ChainRulesCore’s cache.

Solution: nothing that the usual tricks (uninstall, wipe the package specific folder, setting state variables like for GR) solves.

---

<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 27, 2023, 1:40pm UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/6 "2023-07-27T13:40:52Z")

</div>

> [@Paul\_Soderlind](#):
>
> Yesterday, a few packages was updated and suddenly a third of all packages (eg. StatsBase) refused to precompile and the error messages pointed towards ChainRulesCore’s cache.

Hm, that’s not great but purging all of `.julia` is not really the right solution I think. If julia chokes on corrupt precompile files it should just delete those and regenerate a new one. If you could provide concrete examples with what the error output is I think that could help understand what the concrete issue is.

---

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [July 27, 2023, 2:03pm UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/7 "2023-07-27T14:03:51Z")

</div>

Thanks,. But the purging worked well and was quick. I think many people resort to that now and then, which was the reason for the feature request.  
Anyhow, this is how one error message started (and then there were more when I tried to call on some packages):

```julia
Plots → UnitfulExt
  51 dependencies successfully precompiled in 431 seconds. 228 already precompiled.
  1 dependency failed but may be precompilable after restarting julia
  5 dependencies had warnings during precompilation:
┌ SpecialFunctionsChainRulesCoreExt [9eb7bdd4-e44c-55fc-b9cc-1a32cb715188]
│ ┌ Warning: Module ChainRulesCore with build ID fafbfcfd-80b7-b370-0003-63404fd73df5 is missing from the cache.
│ │ This may mean ChainRulesCore [d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4] does not support precompilation but is imported by a module that does.
│ └ @ Base loading.jl:1793
│ ┌ Error: Error during loading of extension LogExpFunctionsChainRulesCoreExt of LogExpFunctions, use `Base.retry_load_extensions()` to retry.
│ │ exception =
│ │ 1-element ExceptionStack:
│ │ Declaring __precompile__ (false) is not allowed in files that are being precompiled.
│ │ Stacktrace:
│ │ [1] _require(pkg::Base.PkgId, env::Nothing)
│ │ @ Base .\loading.jl:1825
│ │ [2] _require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│ │ @ Base .\loading.jl:1660
│ 

```

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 27, 2023, 5:30pm UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/8 "2023-07-27T17:30:37Z")

</div>

One known issue is that a virus scanner puts a compilation artifact in quarantaine. Another issue can appear if pre-compilation was interrupted before it was finished. Or it failed due to lack of free memory. A third known issue is that pre-compilation of a package is broken for a new version of Julia, and that got fixed, but the broken artifacts are still somewhere in the `.julia` folder.

To have an equivalent to

```julia
make clean
make

```

in Julia would be nice.

---

<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 27, 2023, 5:58pm UTC](https://discourse.julialang.org/t/feature-request-add-a-reinstall-all-packages-to-pkg/102128/9 "2023-07-27T17:58:40Z")

</div>

Adding something like [GitHub - KristofferC/PkgFsck.jl: \*Teleports Behind You\* Nothing Personal, Kid](https://github.com/KristofferC/PkgFsck.jl) to the package manager (to fix [pkg\> fsck · Issue #1717 · JuliaLang/Pkg.jl · GitHub](https://github.com/JuliaLang/Pkg.jl/issues/1717)) would indeed be a good idea. That’s for checking and fixing corrupted artifacts and packages.
