# What happens if \`\`Pkg.add\`\` and \`\`Pkg.update\`\` fail or get interrupted?

**URL:** https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574
**Category:** General Usage
**Created:** [July 30, 2021, 11:14pm UTC](https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574 "2021-07-30T23:14:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ZHEN\_LIN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhen_lin/32/27672_2.png) [@ZHEN\_LIN](https://discourse.julialang.org/u/ZHEN_LIN)
#### Post date: [July 30, 2021, 11:14pm UTC](https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574/1 "2021-07-30T23:14:27Z")

</div>

Will the failure or interruption of `Pkg.add` and `Pkg.update` cause any problems to the Julia packages I already have installed?

I had `Gurobi.jl` in my Julia 1.4.2 and I was trying to update it to the most recent version by doing `Pkg.add("Gurobi")`. But it failed due to ` **ERROR:** Unsatisfiable requirements detected for package ...`

I then tried `Pkg.update("Gurobi")`, which did not finish after a long time. So I did `control+c` to stop it and got ` **ERROR:** InterruptException:`.

I finally decided to first stay with the old version I already have and do not do the update.

Now at this point, have the failure and interrupt of `Pkg.add` and `Pkg.update` caused any problems to the current `Gurobi.jl` and other packages I already have installed before?

Some of my codes which worked before still seem to work now, so I assume there is no change, but I just want to make sure is there anything I have to fix?

Thanks.

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [July 30, 2021, 11:15pm UTC](https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574/2 "2021-07-30T23:15:07Z")

</div>

> [@ZHEN\_LIN](#):
>
> is there anything I have to fix?

no (unless your registry of something gets corrupted, but usually it has nothing to do with failure due to unsatisfiability or you Ctrl-C ed it)

---

<div class="post-metadata">

### Author: ![ZHEN\_LIN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhen_lin/32/27672_2.png) [@ZHEN\_LIN](https://discourse.julialang.org/u/ZHEN_LIN)
#### Post date: [July 31, 2021, 12:32am UTC](https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574/3 "2021-07-31T00:32:42Z")

</div>

Thanks! How about other operations such as `Pkg.build`?

Can I always safely `control+c` these operations without affecting other things?

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [July 31, 2021, 8:06am UTC](https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574/4 "2021-07-31T08:06:55Z")

</div>

If something is canceled, it will just continue/start over the next time.

Your phone wouldn’t brick just because you canceled an app installation would it?

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [August 1, 2021, 9:46am UTC](https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574/5 "2021-08-01T09:46:45Z")

</div>

I’ve found ctrl-c during git operations can lead to registry corruption: [https://github.com/JuliaLang/Pkg.jl/issues/2584](https://github.com/JuliaLang/Pkg.jl/issues/2584). It is very easy to fix if you know what is happening and what to do: just `] registry rm General` followed by `] registry add General`. These commands won’t affect installed packages; they just remove and reinstall the registry itself.

The automatic precompilation introduced in v1.6 on the other hand is documented as safe to interrupt.

For `Pkg.build`, that is running whatever code the package author wrote for their build step, so it depends on that code and if they wrote it in a way that is safe to interrupt.

---

<div class="post-metadata">

### Author: ![ZHEN\_LIN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zhen_lin/32/27672_2.png) [@ZHEN\_LIN](https://discourse.julialang.org/u/ZHEN_LIN)
#### Post date: [August 1, 2021, 10:11pm UTC](https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574/6 "2021-08-01T22:11:41Z")

</div>

> [@ericphanson](#):
>
> I’ve found ctrl-c during git operations can lead to registry corruption

Thanks for sharing! May I ask how you were able to find out there was corruption? Was it because your code was not running? Are there ways to find out corruption whose occurrence is silent and does not raise an error?

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [August 2, 2021, 12:50am UTC](https://discourse.julialang.org/t/what-happens-if-pkg-add-and-pkg-update-fail-or-get-interrupted/65574/7 "2021-08-02T00:50:49Z")

</div>

The way I found out is on trying to install a package I’d get error messages like

> Unsatisfiable requirements detected for package […].  
> … […] has no known versions!\*

when I know that the package definitely does have versions in the registry. I don’t know how to detect silent corruption but reinstalling the registry would still fix it. I guess you could clone the registry yourself and diff against the one you have on disk to see if there’s any differences.
